OCaml Forge
SCM

Detail: [#1363] Unix_error raised when using process runner and lwt

Bugs: Browse | Download .csv | Monitor

[#1363] Unix_error raised when using process runner and lwt

Date:
2014-01-18 00:45
Priority:
3
State:
Open
Submitted by:
Tim Cuthbertson (gfxmonk)
Assigned to:
Sylvain Le Gall (gildor-admin)
Severity:
None
Component:
Core
Product:
OUnit library
Resolution:
None
Version:
v2.0.0
 
URL:
Status:
Open
 
Summary:
Unix_error raised when using process runner and lwt

Detailed description
When running my tests, I started getting this error consistently:

Fatal error: exception Unix.Unix_error(11, "select", "")
Raised by primitive operation at unknown location
Called from file "src/oUnitRunnerProcesses.ml", line 191, characters 32-56
Called from file "src/oUnitRunnerProcesses.ml", line 213, characters 14-54
Called from file "src/oUnitRunner.ml", line 358, characters 15-37
Called from file "list.ml", line 84, characters 24-34
Called from file "src/oUnitRunner.ml", line 462, characters 21-43
Called from file "src/oUnitRunner.ml", line 499, characters 18-36
Called from file "src/oUnitUtils.ml", line 172, characters 12-15
Called from file "src/oUnitCore.ml", line 83, characters 4-59
Called from file "src/oUnitCore.ml", line 172, characters 10-55
Called from file "test/test.ml", line 5, characters 1-89

Using `git bisect`, I tracked this down to first appearing with the commit that first introduced `lwt` as a dependency in my project (although I don't believe any of my unit tests actually exercise any lwt code).

Running with `-runner sequential` makes this problem go away, so I presume it's something specific to the process runner. I could try to put together a minimal test case if the above stacktrace isn't sufficient, but it might be quite hard (I can't really tell what's causing it, and I'm still quite new to ocaml). So I'm hoping the above details are sufficient.

Followup

Message
Date: 2014-06-05 13:26
Sender: Thomas Leonard

I sent this fix a while back, but I don't see it in the code repository, so posting it here in case anyone else needs it.

From cf340e0fb496d8b120f9b0528b8243fdf6f592c2 Mon Sep 17 00:00:00 2001
From: Thomas Leonard <talex5@gmail.com>
Date: Mon, 25 Nov 2013 11:54:49 +0000
Subject: [PATCH] Restart select call if it gets interrupted

---
src/oUnitRunnerProcesses.ml | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/oUnitRunnerProcesses.ml b/src/oUnitRunnerProcesses.ml
index 5a1466d..498f5cc 100644
--- a/src/oUnitRunnerProcesses.ml
+++ b/src/oUnitRunnerProcesses.ml
@@ -186,14 +186,18 @@ let create_worker conf map_test_cases shard_id master_id worker_log_file =
false, None
end else begin
let running = is_running () in
- if running then
+ if running then begin
(* Wait 0.1 seconds and continue. *)
- let _, _, _ = Unix.select [] [] [] 0.1 in
- wait_end (timeout -. 0.1)
- else
+ begin
+ try ignore (Unix.select [] [] [] 0.1)
+ with Unix.Unix_error (Unix.EINTR, "select", "") -> ()
+ end;
+ wait_end (timeout -. 0.1)
+ end else begin
match !rstatus with
| Some status -> true, msg_of_process_status status
| None -> true, None
+ end
end
in

--
1.8.4.2
Date: 2014-01-21 20:58
Sender: Tim Cuthbertson

Great, thanks - the workaround of the sequential runner is fine for me (my tests take <1s), but thought it worth reporting :)
Date: 2014-01-21 08:09
Sender: Sylvain Le Gall

I already got a patch for that, will apply for the next release.

Attached Files:

Changes:

Field Old Value Date By
assigned_tonone2014-01-21 08:09gildor-admin