You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 7366 Reporter: pmetras Status: resolved (set by @xavierleroy on 2017-02-16T08:53:43Z) Resolution: not a bug Priority: normal Severity: minor Platform: i386 OS: Minix3 OS Version: 3.4.0 Category: otherlibs Monitored by:@gasche
Bug description
The testsuite fails for some tests in lib-threads but I was unable to find the reason. This is related to the generated byte code. For instance, the test testsuite/tests/lib-threads/socketsbuf.ml fails, when executed with the just generated from sources OCaml version. But it passes if the same OCaml version is installed in /usr/local! The same bug occurs for testsuite/tests/lib-threads/fileio.ml.
$ ../byterun/ocamlrun -b -I ../stdlib -I ../otherlibs/threads -I ../otherlibs/unix ./program
Thread 2 killed on uncaught exception Sys_blocked_io
Raised by primitive operation at file "pervasives.ml", line 415, characters 4-749
Called from file "socketsbuf.ml", line 26, characters 10-23
Called from file "thread.ml", line 131, characters 8-14
Fatal error: exception Sys_blocked_io
Raised by primitive operation at file "pervasives.ml", line 415, characters 4-749
Called from file "socketsbuf.ml", line 26, characters 10-23
Called from file "socketsbuf.ml", line 46, characters 2-30
For people interested in system debugging, the exception occurs in byterun/unix.c, in function caml_read_fd.
The problem is in the generated code and the location of stdlib.
Steps to reproduce
To reproduce the bug it:
Compile the full OCaml distribution
Run the test socketsbuf.ml from the testsuite: it fails...
Compile it with "../byterun/ocamlrun ../ocamlc -g -I ../stdlib -w a -vmthread -I ../otherlibs/threads -I ../otherlibs/unix unix.cma threads.cma tests/lib-threads/socketsbuf.ml -o program". The testsuite version uses "-nostdlib -I ../testsuite/lib" parameters that does not affect the result and that we removed.
Run it with "../byterun/ocamlrun -b -I ../stdlib -I ../otherlibs/threads -I ../otherlibs/unix ./program". It fails again...
Become root and install the Ocaml distribution
Run again the program, but now you don't need all the includes as you use the system OCaml: "./program". It still fails...
Compile it with the system ocaml compiler: "ocamlc -g -w a -vmthread unix.cma threads.cma socketsbuf.ml -o program"
Run it: "./program". IT WORKS!
Delete the system OCaml installation in /usr/local.
Check you've done the job correctly: "./program" should print "./program: not found".
Run it again with "../byterun/ocamlrun -b -I ../stdlib -I ../otherlibs/threads -I ../otherlibs/unix ./program". IT STILL WORKS NOW!!!
You can see that the good and the bad programs have different sizes but I haven't seen an option to extract the generated bytecode and find the differences.
When the OCaml distribution is installed on the system, the shortest way to see the bug is:
Program generated by "ocamlc -g -w a -vmthread -I ../stdlib/ unix.cma threads.cma socketsbuf.ml -o program" fails
Program generated by "ocamlc -g -w a -vmthread unix.cma threads.cma socketsbuf.ml -o program" executes successfully
Additional information
Minix3 does not have system threads and I've adapted the testsuite to use VM threads instead.
The text was updated successfully, but these errors were encountered:
Thanks for the repro instructions, which enabled me to reproduce the exception on a Linux system. This is actually normal behavior, although it took me a while to understand why.
VMthreads come with their own version of the stdlib, which in particular changes I/O functions to use nonblocking mode. By compiling with "-vmthreads", the correct, VMthread-aware version of the stdlib is selected. By compiling with "-vmthreads -I ../../../stdlib", the normal, non-VMthread-aware version of the stdlib is selected.
For this reason and others, tests/lib-threads should not be used with VMthreads, because they have not been designed to.
Original bug ID: 7366
Reporter: pmetras
Status: resolved (set by @xavierleroy on 2017-02-16T08:53:43Z)
Resolution: not a bug
Priority: normal
Severity: minor
Platform: i386
OS: Minix3
OS Version: 3.4.0
Category: otherlibs
Monitored by: @gasche
Bug description
The testsuite fails for some tests in lib-threads but I was unable to find the reason. This is related to the generated byte code. For instance, the test testsuite/tests/lib-threads/socketsbuf.ml fails, when executed with the just generated from sources OCaml version. But it passes if the same OCaml version is installed in /usr/local! The same bug occurs for testsuite/tests/lib-threads/fileio.ml.
$ ../byterun/ocamlrun -b -I ../stdlib -I ../otherlibs/threads -I ../otherlibs/unix ./program
Thread 2 killed on uncaught exception Sys_blocked_io
Raised by primitive operation at file "pervasives.ml", line 415, characters 4-749
Called from file "socketsbuf.ml", line 26, characters 10-23
Called from file "thread.ml", line 131, characters 8-14
Fatal error: exception Sys_blocked_io
Raised by primitive operation at file "pervasives.ml", line 415, characters 4-749
Called from file "socketsbuf.ml", line 26, characters 10-23
Called from file "socketsbuf.ml", line 46, characters 2-30
For people interested in system debugging, the exception occurs in byterun/unix.c, in function caml_read_fd.
The problem is in the generated code and the location of stdlib.
Steps to reproduce
To reproduce the bug it:
You can see that the good and the bad programs have different sizes but I haven't seen an option to extract the generated bytecode and find the differences.
When the OCaml distribution is installed on the system, the shortest way to see the bug is:
Additional information
Minix3 does not have system threads and I've adapted the testsuite to use VM threads instead.
The text was updated successfully, but these errors were encountered: