Ticket #4362 (closed bug: fixed)
error in multithreaded program "epollControl: does not exist (No such file or directory)"
|Reported by:||guest||Owned by:|
|Keywords:||Cc:||johan.tibell@…, bos@…, bit@…, mail@…|
|Type of failure:||Incorrect result at runtime||Difficulty:|
|Test Case:||Blocked By:|
I wrote a program that is a standard multi threaded tcp server. It listens on a socket, and then it enters a loop where it does an accept for a new connection and then handles the connection on a new thread using forkIO. For each incoming connection, the program reads some data from the socket and then downloads a file from the web using the function simpleHTTP from the HTTP library.
My program runs fine most of the time, but every now and then when I run my program, all of the simpleHTTP calls throw an IOException, with the error:
epollControl: does not exist (No such file or directory)
My program also has an additional background thread, started at program startup with forkIO, that periodically calls simpleHTTP and these calls always work, and they continue to work even as the calls from the connection threads throw the above error.
From looking at the library code, it seems simpleHTTP eventually calls one of the low level socket functions which in turn calls System.Event.Thread.ensureIOManagerIsRunning, which calls System.Event.EPoll.new, which calls epoll_ctl which fails.
epoll_ctl man page tells me that the reason for this error is: "ENOENT: op was EPOLL_CTL_MOD or EPOLL_CTL_DEL, and fd is not in epfd."
As I said above, this problem is hard to reproduce, it only happens once every 30 or so invocations of my program.
I am using ghc 7.1.20100925 and Linux 2.6.31 I am compiling with -threaded -O2
I'd be happy to give any any other needed information.