I'm debugging a non-trivial multithreaded unit test in the current
version of lang/ghc. It runs into some kind of unexpected condition not
handled well by GHC. I suspect we do something non-standard to cause
this behavior. These two ktrace items illustrate the issue:

 12550/209588  T21651   CALL  kevent(217,0x211906e98,1,0,0,0x211906e78)
 12550/209588  T21651   STRU  struct kevent { ident=13, filter=EVFILT_WRITE, 
flags=0x11<EV_ADD|EV_ONESHOT>, fflags=0x2<NOTE_EOF>, data=0, udata=0x0 }
 12550/209588  T21651   RET   kevent -1 errno 32 Broken pipe
 
 12550/209588  T21651   CALL  kevent(217,0x211906ee8,1,0,0,0x211906ec8)
 12550/209588  T21651   STRU  struct kevent { ident=13, filter=EVFILT_WRITE, 
flags=0x2<EV_DELETE>, fflags=0x2<NOTE_EOF>, data=0, udata=0x0 }
 12550/209588  T21651   RET   kevent -1 errno 2 No such file or directory

errno 2 is the reason GHC goes berserk, but it seems like the earlier
return of errno 32 (EPIPE) is the first time things go wrong. I don't
see EPIPE documented as a valid error in kevent(2). It's also nowhere
to be found in sys/kern/kern_event.c. This errno value pops up from
some other place that I can't quickly locate.

So, is EPIPE a valid errno which we should document or a kernel bug?

The complete ktrace in case somebody can glean more out of that pile:
https://github.com/blackgnezdo/blackgnezdo.github.io/blob/junk/ktrace.out.gz?raw=true

I'm running a May 1 snapshot on amd64.

Thanks
Greg

Reply via email to