Fork process is very very different from forkIo and fork os. Have you tried fork bombing from shell with a similar program? I don't think your os can handle 2^1000 process ids? Right? I seem to reall process ids being 32 or 64 bit. <span></span><br><br>On Sunday, July 24, 2016, Lana Black <lanablack@amok.cc> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 21:25 Sun 24 Jul , Anatoly Yakovenko wrote:<br>
> It's probably out of file descriptors. It's possible that it tries to open<br>
> another one during the error handling.<br>
> On Sun, Jul 24, 2016 at 10:50 AM Lana Black <lanablack@amok.cc> wrote:<br>
><br>
> > Hello,<br>
> ><br>
> > I have run into this RTS bug recently. In short, when executing multiple<br>
> > consequtive forks, after 500-600 or so the process is terminated by<br>
> > SIGSEGV. I know this kind of thing is totally artificial, but still.<br>
> ><br>
> > The problem I have is that I can't get any meaningful backtrace in gdb.<br>
> > For example, for threaded RTS I get this<br>
> ><br>
> > (gdb) bt<br>
> > #0 0x0000000000560d63 in<br>
> > base_GHCziEventziThread_ensureIOManagerIsRunning1_info ()<br>
> > Backtrace stopped: Cannot access memory at address 0x7fffff7fcea0<br>
> ><br>
> > For non-threaded RTS I get this<br>
> ><br>
> > (gdb) bt<br>
> > #0 0x00000000007138c9 in stg_makeStablePtrzh ()<br>
> > Backtrace stopped: Cannot access memory at address 0x7fffff7fc720<br>
> ><br>
> > Build command: ghc --make -O2 -g -fforce-recomp fork.hs<br>
> > Add threaded if needed.<br>
> ><br>
> > I was able to reproduce this bug with both GHC 7.10.3 and todays HEAD<br>
> > with the code below.<br>
> ><br>
> > >import System.Exit (exitSuccess)<br>
> > >import System.Posix.Process (forkProcess)<br>
> > ><br>
> > >fork_ n | n > 0 = processPid =<< forkProcess (fork_ $! n - 1)<br>
> > > | otherwise = putStrLn "I'm done!"<br>
> > ><br>
> > >processPid pid | pid > 0 = exitSuccess<br>
> > > | pid < 0 = putStrLn "OOOPS, forkProcess failed!"<br>
> > > | otherwise = pure ()<br>
> > ><br>
> > >main = fork_ 1000<br>
> > ><br>
> ><br>
> > With best regards.<br>
> > _______________________________________________<br>
> > Haskell-Cafe mailing list<br>
> > To (un)subscribe, modify options or view archives go to:<br>
> > <a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
> > Only members subscribed via the mailman list are allowed to post.<br>
<br>
Seems like this is not the case. I actually overlooked GHCs -debug<br>
option, with it I'm now able to get a stacktrace. Furthermore, the<br>
number of used file descriptors is well within the limit, and changing<br>
the latter with `ulimit -n` does not affect the outcome.<br>
<br>
Curiously, the stacks are rather different for threaded and non-threaded<br>
RTS.<br>
<br>
Non-threaded:<br>
(gdb) bt<br>
#0 INFO_PTR_TO_STRUCT (info=<error reading variable: Cannot access<br>
memory at address 0x7fffff7feff0>) at<br>
includes/rts/storage/ClosureMacros.h:60<br>
#1 0x000000000070e956 in get_itbl (c=0x20006e7f8) at<br>
includes/rts/storage/ClosureMacros.h:87<br>
#2 0x000000000070ec3c in closure_sizeW (p=0x20006e7f8) at<br>
includes/rts/storage/ClosureMacros.h:439<br>
#3 0x000000000070ecf7 in overwritingClosure (p=0x20006e7f8) at<br>
includes/rts/storage/ClosureMacros.h:555<br>
#4 0x0000000000725dd7 in stg_upd_frame_info ()<br>
#5 0x0000000000000000 in ?? ()<br>
<br>
Threaded:<br>
(gdb) bt<br>
#0 0x00007ffff6ce49ce in _IO_vfprintf_internal (s=s@entry=0x7fffff7ff430, format=format@entry=0x7ffff75c3550 "/proc/self/task/%u/comm", ap=ap@entry=0x7fffff7ff558)<br>
at vfprintf.c:1266<br>
#1 0x00007ffff6d0954b in __IO_vsprintf (string=0x7fffff7ff630 "`\366\177\377\377\177", format=0x7ffff75c3550 "/proc/self/task/%u/comm", args=args@entry=0x7fffff7ff558)<br>
at iovsprintf.c:42<br>
#2 0x00007ffff6cecd47 in __sprintf (s=s@entry=0x7fffff7ff630 "`\366\177\377\377\177", format=format@entry=0x7ffff75c3550 "/proc/self/task/%u/comm") at sprintf.c:32<br>
#3 0x00007ffff75c1f2b in pthread_setname_np (th=140737317025536, name=0x78ba04 "ghc_ticker") at ../sysdeps/unix/sysv/linux/pthread_setname.c:49<br>
#4 0x000000000072ce4e in initTicker (interval=10000000, handle_tick=0x71a23d <handle_tick>) at rts/posix/itimer/Pthread.c:173<br>
#5 0x000000000071a32f in initTimer () at rts/Timer.c:111<br>
#6 0x0000000000703c26 in forkProcess (entry=0x207) at rts/Schedule.c:2072<br>
#7 0x0000000000405bf7 in s7dF_info ()<br>
#8 0x0000000000000000 in ?? ()<br>
<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote>