iu-parfunc / lvars

The LVish Haskell library
http://hackage.haskell.org/package/lvish
80 stars 14 forks source link

Problem with main worker not starting #97

Closed rrnewton closed 10 years ago

rrnewton commented 10 years ago

When we run STRESSTESTS=N where N>1, then we see tests hanging right now. Looking at the debug log output we see this. On he first run(s), we start up two auxiliary workers and one main thread:

\1|  [dbg-lvish] Initialized Logger...
\1|  [dbg-lvish] New logger & scheds created... entering main loop.
\3| wrkr2  [dbg-lvish] Auxillary worker #2 starting.
\3| wrkr1  [dbg-lvish] Auxillary worker #1 starting.
\3| wrkr0  [dbg-lvish] Main worker thread starting.
\4|  [dbg-lvish] (main tid ThreadId 9) Wait on at least one async to complete..

But on the last run where we hang, ALL THREE threads decide that they are auxillary workers:

\1|  [dbg-lvish] Initialized Logger...
\1|  [dbg-lvish] New logger & scheds created... entering main loop.
\4|  [dbg-lvish] (main tid ThreadId 9) Wait on at least one async to complete..
\3| wrkr2  [dbg-lvish] Auxillary worker #2 starting.
\3| wrkr1  [dbg-lvish] Auxillary worker #1 starting.
\3| wrkr0  [dbg-lvish] Auxillary worker #0 starting.

Something is wrong....

rrnewton commented 10 years ago

By adding a little extra debug print, we can see that, indeed, main_cpu has a wrong value:

\4|  [dbg-lvish] (main tid ThreadId 9) Wait on at least one async to complete..
\3| wrkr0  [dbg-lvish] Auxillary worker #0 starting (main cpu 3).
\3| wrkr2  [dbg-lvish] Auxillary worker #2 starting (main cpu 3).
\3| wrkr1  [dbg-lvish] Auxillary worker #1 starting (main cpu 3).