On Sun, Dec 22, 2002 at 09:54:12AM -0500, Phil Hargett wrote:
Okay, here's an interesting additional bit of info. I just stepped through the method UnixProcess class>>catAFile in a Squeak debugger--and no crashes! This was the core method that caused one of the test cases to fail by aborting the VM.
Here's my thought: is it a timing issue? It seems that the bulk of the work in this method involves forking a child process--could it be that code is attempting to access something about the child process before it's created--or after it is already complete? I don't know, but given that it worked in the debugger and not when simply run directly suggests it's just a timing thing.
??
This is wild speculation on my part, but supposing that it is timing dependent, the likely culprit would be my handler for SIGCHLD. UnixOSProcessPlugin catches this signal and does a #signalSemaphoreWithIndex: to notify Squeak that a child process has exited (a Process held by a singleton instance of UnixOSProcessAccessor does the work, and you can evaluate "OSProcess accessor" to look at it).
I do not do anything at all to make sure that the signal handler works properly in a threaded VM (pthreads). This has not seemed to be an issue, but I do know that the plugin does not work on Mac OS/X, and I suspect that this may be due to the signal handler handling SIGCHLD in the context of the wrong thread.
Now for the wild hypothesis: As far as I know, the MPEG plugin is the only thing that does pthreads in the Unix VM. If you take it out of your build, perhaps the OSProcess sUnit tests will get healthy.
If that does the trick, I suggest 1) that you build the MPEG and OSPP plugins externally, and 2) that yours truly should start reading the man pages and figure out how pthreads work sometime soon.
Dave
p.s. I'm not sure that all flavors of Unix actually *have* pthreads, and I have the impression that pthreads implementations may not be very well standardized across platforms, so I have not been in a big hurry to add something to the OSPP code that would not work on some platforms.