In the meantime I managed to get Irmin_http work together with
Cohttp_mirage.Client (see other mail), but:

When I'm running my test suite against a unix-socket version of the
unikernel, it eventually crashes with a weird exception 'Fatal error:
exception Unix.Unix_error(Unix.EBADF, "check_descriptor", "")'. Of course
it doesn't happen, if I run the kernel as a ukvm instance. I tried to catch
the exception by wrapping all Irmin_http function calls with Lwt.catch()(),
but without success. Also worth to note is, that I see the exception
several times before, where it doesn't crash the unikernel, so it is
actually caught in the cases before, but eventually there comes an event,
where it is not caught. It's also not always the same moment during the
test, but seems to depend on a racey condition. (Btw, http server and
client are using the same conduit, but that shouldn't be a problem, right?)
Here's the not so interesting backtrace:

2017-11-30 02:51:00 +01:00: INF [https] [1] serving
//localhost:8080/api/v0/keys/myId123/actions/decrypt.
2017-11-30 02:51:00 +01:00: DBG [irmin.http] GET /branch/master
Fatal error: exception Unix.Unix_error(Unix.EBADF, "check_descriptor", "")
Raised at file "lwt_unix.cppo.ml", line 362, characters 4-64
Called from file "lwt_unix.cppo.ml", line 610, characters 28-47
Called from file "src/core/lwt.ml", line 2073, characters 21-28
Called from file "src/cohttp_mirage.ml", line 50, characters 41-59
Called from file "map.ml", line 196, characters 19-42
Called from file "src/unix/lwt_engine.ml", line 344, characters 16-68
Called from file "src/unix/lwt_main.ml", line 40, characters 4-78
Called from file "main.ml", line 170, characters 5-10


Some research shows that I'm not the first one seeing this, but
unfortunately in the other cases the problem "mysteriously" disappeared.
[1][2][3]

Also Tom Ridge and Hannes talked about the topic recently. [4]

Looking at the Lwt code[5] I'm a bit confused that raise and Lwt.fail are
somehow used interchangeably. I'm still not sure that I understood how to
deal correctly with exceptions in Lwt. :-/

So is that a bug in Lwt, or Irmin is not handling the exceptions correctly,
or I must have missed a spot where I should catch it?

Thanks for any hints or comments!


Cheers,

Sven

[1] https://github.com/frenetic-lang/ocaml-openflow/issues/25
[2] https://github.com/openvstorage/arakoon/issues/203
[3] https://github.com/moby/vpnkit/issues/156
[4] https://discuss.ocaml.org/t/system-calls-unix-close-signals-eintr/972
[5]
https://github.com/ocsigen/lwt/blob/master/src/unix/lwt_unix.cppo.ml#L368
_______________________________________________
MirageOS-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/mirageos-devel

Reply via email to