utop icon indicating copy to clipboard operation
utop copied to clipboard

dune top loads lwt/unix/lwt_unix.cma which starts event loop

Open Lupus opened this issue 5 years ago • 0 comments

I'm trying to leverage dune toplevel integration (docs: https://dune.readthedocs.io/en/stable/toplevel-integration.html), my project is using lwt, and somewhere in the middle of generated output from dune top there is the following line:

#load "/home/vagrant/git/ocaml/my-project/_opam/lib/lwt/unix/lwt_unix.cma";;

utop hangs on this. I've launched utop in gdb, and hitting ctrl+c gives the following backtrace after utop "hangs":

#use_output "cat foo.ml";;
[Detaching after fork from child process 5513]
^C
Thread 1 "ocamlrun" received signal SIGINT, Interrupt.
0x00007ffff7d507ef in epoll_wait (epfd=3, events=0x5555555d3de0, maxevents=64, timeout=59743) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
30      ../sysdeps/unix/sysv/linux/epoll_wait.c: No such file or directory.
(gdb) bt
#0  0x00007ffff7d507ef in epoll_wait (epfd=3, events=0x5555555d3de0, maxevents=64, timeout=59743) at ../sysdeps/unix/sysv/linux/epoll_wait.c:30
#1  0x00007ffff70cd873 in ?? () from /lib/x86_64-linux-gnu/libev.so.4
#2  0x00007ffff70cfcde in ev_run () from /lib/x86_64-linux-gnu/libev.so.4
#3  0x00007ffff70eced8 in ev_loop (flags=2, loop=0x5555555d3870) at /usr/include/ev.h:836                                                                                    
#4  lwt_libev_loop (val_loop=<optimized out>, val_block=<optimized out>) at lwt_libev_stubs.c:102                                                                            
#5  0x0000555555583222 in caml_interprete (prog=0x7ffff710f010, prog_size=<optimized out>) at interp.c:908                                                                   
#6  0x0000555555585ac2 in caml_main (argv=0x7fffffffde78) at startup_byt.c:448
#7  0x00005555555686cc in main (argc=<optimized out>, argv=<optimized out>) at main.c:44                                                                                     

So it seems that it started the event loop. That does not seem to be the intended behavior :)

/cc @aantron

dune version 2.5.0 utop version 2.4.3 OCaml version 4.08.1 lwt version 5.2.0

Lupus avatar Jul 03 '20 06:07 Lupus