<html><head><base href="x-msg://759/"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">mmap is strongly preferred over sbrk.<div><br></div><div>I'd need to understand the control flow here in and across the processes, but yes, generally, mixing pthreads with fork may require significant care.</div><div>
<br><div><div>On 16 Mar 2010, at 11:33, Jay K wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div class="hmmessage" style="font-size: 10pt; font-family: Verdana; ">Daniel thank you for the bug report.<br>Thank you for suggesting strace. I used strace<br>and compared working vs. non-working.<br>And started added RTIO everywhere.<br>You can also use cvsup -f to slightly simplify -- one fork instead of two.<br>gdb set follow mode didn't seem to help.<br> <br> <br>I almost have it nailed down.<br> <br> <br>in CVSup, FSServer.m3, this code:<br> <br>FINALLY<br> IF isChild THEN<br> SigHandler.ShutDown(); <==<span class="Apple-converted-space"> </span><br> ELSE<br> SigHandler.Unblock();<br> END;<br>END;<br><br> <br>which runs fairly early, never returns in the child.<br> <br> <br>It ends up here:<br> <br> <br>PROCEDURE ChangeState(d: Dispatcher; state: State) =<br> (* Ask the dispatcher thread to change to a new state, and wait until<br> it has made the change. *)<br> BEGIN<br> LOCK d.mu DO<br> d.desiredState := state;<br> IF d.state # d.desiredState THEN<br> IF d.state = State.Running THEN<br> (* Send dummy signal 0 to wake up the dispatcher. *)<br> Catch(0);<br> ELSE<br> Thread.Signal(d.changeState);<br> END;<br> WHILE d.state # d.desiredState DO<br> Thread.Wait(d.mu, d.stateChanged); <== this never returns<br> END;<br> END;<br> END;<br> END ChangeState;<br> <br> <br>It's a bit wierd to be mixing fork() and Modula-3 Thread?<br>Or maybe it is ok?<br> <br> <br>See, they are asking another process, from the fork() point of view, to change the state.<br> It does so, but the write is private.<br> <br> <br>Remember...Olaf changed from sbrk to mmap(anon|private) in RTOS.GetMemory()?<br> sbrk is maybe shared? mmap(anon|private) is not.<br> <br>Right now I have<br>#ifndef apple<br>sbrk<br>#else<br>mmap(anon|shared)<br>#endif<br> <br> <br>and it gets further.<br>Hit an assertion failure in pthread.<br>I'll try again.<br>Cleanup all my RTIO.<br> <br> <br>Maybe this notion of using fork() is just not supportable?<br> <br> <br>In either case...you could paint it as an m3core problem, but<br>?it won't affect much code?.<br> <br> <br> - Jay<br> <br><hr id="stopSpelling">From:<span class="Apple-converted-space"> </span><a href="mailto:jay.krell@cornell.edu">jay.krell@cornell.edu</a><br>To:<span class="Apple-converted-space"> </span><a href="mailto:m3devel@elegosoft.com">m3devel@elegosoft.com</a><br>Subject: cvsup<br>Date: Tue, 16 Mar 2010 12:32:49 +0000<br><br>I can reproduce the cvsup problem.<br>An important point to consider is that cvsupd forks a server?<br> Maybe that messes up initialization?<br> I'll dig further.<br> <br> <br>I think these steps are complete.<br>I'll test them on a second clean system.<br>You don't need any real data.<br> <br> <br><a href="mailto:jay@xlin2:~$">jay@xlin2:~$</a><span class="Apple-converted-space"> </span>cat cvsupd.cfg<br>*default tag=.<br>*default host=xlin2.<br>*default prefix=/home/jay<br>*default base=/home/jay/var/db<br>*default release=cvs delete use-rel-suffix compress<br> <br>src-all<br> <br> <br>mkdir -p $HOME/var/db<br>mkdir -p $HOME/data/cvsupd<br>pkill cvsupd # cleanup any previous<br> <br> <br>You don't really need any data.<br>cvsup/cvsupd will issue an error in the "working" case, and<br>hang in the non-working case.<br> <br><br><br><br>run the server:<br> <br> <br><a href="mailto:jay@xlin2:~$">jay@xlin2:~$</a><span class="Apple-converted-space"> </span>/cm3/bin/cvsupd -b $HOME/data/cvsupd<br>2010.03.16 05:24:25 PDT [22555]: CVSup server started<br>2010.03.16 05:24:25 PDT [22555]: Software version: 2010-03-05 10:55:15<br>2010.03.16 05:24:25 PDT [22555]: Protocol version: 17.0<br>2010.03.16 05:24:25 PDT [22555]: Ready to service requests<br><br><br>run the client:<br> <br> /cm3/bin/cvsup -g -L 2 $HOME/cvsupd.cfg<br> <br> <br>Parsing supfile "/home/jay/cvsupd.cfg"<br>Connecting to xlin2.<br>Connected to xlin2.<br>Server software version: 2010-03-05<br>Negotiating file attribute support<br>Exchanging collection information<br>Server message: Unknown collection "src-all"<br>Establishing multiplexed-mode data connection<br>Running<br>Skipping collection src-all/cvs<br>Shutting down connection to server<br>Finished successfully<br> <br>it is able to talk to the server, and then fails.<br>Ok -- at least it talked to the server.<br> <br>The server then exits too.<br>I think that is correct (read the usage on the -C option).<br> <br> <br>Then try with -C.<br>The bug says -C 2. Let's use -C 1.<br>They behave the same for our purposes.<br> <br> <br>Just add -C 1 to the above server.<br>Run the same client.<br>The client hangs -- it never connects to the server.<br> <br> <br>I reproduced this on LINUXLIBC6 and PPC_LINUX.<br>Maybe more soon.<br>I'm just rebuilding first.<br> <br> <br> - Jay<br></div></span></blockquote></div><br></div></body></html>