ExternalProcess on OSX leaves Zombies

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

ExternalProcess on OSX leaves Zombies

cdavidshaffer
I have code that depends on "wait" to sense when an external process has completed.  Works OK under Linux but under OSX and VW7.7.1 I have problems.  Here's a short snippet that demonstrates:

100 timesRepeat:
        [proc := ExternalProcess new.
        proc cshOne: 'ls'.
        proc wait]

This locks up in the wait after the second or so process is launched.  Sending "ExternalProcess reapOne" kicks it on to the next process.  It seems like ExternalProcess "statusChangeSemaphore" isn't getting properly signaled when children exit under OSX.  ps shows the child process is a zombie.

Anyone know of a fix for this?  Couldn't find anything in the vwnc archives under "OSX zombie ExternalProcess".

David


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProcess on OSX leaves Zombies

cdavidshaffer

On Mar 15, 2011, at 12:27 AM, David Shaffer wrote:

> I have code that depends on "wait" to sense when an external process has completed.  Works OK under Linux but under OSX and VW7.7.1 I have problems.  Here's a short snippet that demonstrates:
>
> 100 timesRepeat:
> [proc := ExternalProcess new.
> proc cshOne: 'ls'.
> proc wait]
>
> This locks up in the wait after the second or so process is launched.  Sending "ExternalProcess reapOne" kicks it on to the next process.  It seems like ExternalProcess "statusChangeSemaphore" isn't getting properly signaled when children exit under OSX.  ps shows the child process is a zombie.
>
> Anyone know of a fix for this?  Couldn't find anything in the vwnc archives under "OSX zombie ExternalProcess".
>
> David
>
A couple of notes as a follow up to my own post:

1) Sometimes the "wait" returns.  Changing the 100 to 5 gives a loop that terminates most of the time.

2) I find that if I launch the external processes one at a time (with significant delay between) then everything seems OK.

3) I tried adding "proc release" after the wait, to no effect

4) "ExternalProcess reapOne" should have been "UnixProcess reapOne" but it doesn't actually help.  The smalltalk process remains blocked in the #wait call.

David

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProcess on OSX leaves Zombies

cdavidshaffer

On Mar 15, 2011, at 12:47 AM, David Shaffer wrote:

>
> On Mar 15, 2011, at 12:27 AM, David Shaffer wrote:
>
>> I have code that depends on "wait" to sense when an external process has completed.  Works OK under Linux but under OSX and VW7.7.1 I have problems.  Here's a short snippet that demonstrates:
>>
>> 100 timesRepeat:
>> [proc := ExternalProcess new.
>> proc cshOne: 'ls'.
>> proc wait]
>>

I have posted a workaround on the CIncom Public repo called OSXExternalProcessFix.  The workaround starts a process that periodically signals the status change semaphore thereby causing VW to "wait" for the zombie process.  This workaround is less than ideal since the activity generated by signaling this semaphore when no process has exited is wasted in most cases.  I'm not aware of any problems with it, however.

David


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProcess on OSX leaves Zombies

Michael Lucas-Smith-2

On Mar 16, 2011, at 11:45 AM, David Shaffer wrote:

>
> On Mar 15, 2011, at 12:47 AM, David Shaffer wrote:
>
>>
>> On Mar 15, 2011, at 12:27 AM, David Shaffer wrote:
>>
>>> I have code that depends on "wait" to sense when an external process has completed.  Works OK under Linux but under OSX and VW7.7.1 I have problems.  Here's a short snippet that demonstrates:
>>>
>>> 100 timesRepeat:
>>> [proc := ExternalProcess new.
>>> proc cshOne: 'ls'.
>>> proc wait]
>>>
>
> I have posted a workaround on the CIncom Public repo called OSXExternalProcessFix.  The workaround starts a process that periodically signals the status change semaphore thereby causing VW to "wait" for the zombie process.  This workaround is less than ideal since the activity generated by signaling this semaphore when no process has exited is wasted in most cases.  I'm not aware of any problems with it, however.
>

It does look like exitSemaphore has been left behind a bit -- I'll look in to it (AR62658). However, the cshOne: API will have ended by the time the call returns, so the #wait is redundant in this case.

Michael
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProcess on OSX leaves Zombies

Michael Lucas-Smith-2

On Mar 16, 2011, at 12:19 PM, Michael Lucas-Smith wrote:

>
> On Mar 16, 2011, at 11:45 AM, David Shaffer wrote:
>
>>
>> On Mar 15, 2011, at 12:47 AM, David Shaffer wrote:
>>
>>>
>>> On Mar 15, 2011, at 12:27 AM, David Shaffer wrote:
>>>
>>>> I have code that depends on "wait" to sense when an external process has completed.  Works OK under Linux but under OSX and VW7.7.1 I have problems.  Here's a short snippet that demonstrates:
>>>>
>>>> 100 timesRepeat:
>>>> [proc := ExternalProcess new.
>>>> proc cshOne: 'ls'.
>>>> proc wait]
>>>>
>>
>> I have posted a workaround on the CIncom Public repo called OSXExternalProcessFix.  The workaround starts a process that periodically signals the status change semaphore thereby causing VW to "wait" for the zombie process.  This workaround is less than ideal since the activity generated by signaling this semaphore when no process has exited is wasted in most cases.  I'm not aware of any problems with it, however.
>>
>

Hi David,

There seems to be something special going on here. I'm not able to reproduce your test case. CShell running ls always quits cleanly for me. There are no zombies in ps and no matter how many times I run it, they all clean up properly as I would expect. If there is a problem here, it has to originate in the VM not signalling the exit. Are you able to try again using VW7.8? I'd be interested in knowing if a change in the VM on OSX has fixed your problem.

Michael



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: ExternalProcess on OSX leaves Zombies

cdavidshaffer

On Mar 31, 2011, at 5:02 PM, Michael Lucas-Smith wrote:

>
>
> Hi David,
>
> There seems to be something special going on here. I'm not able to reproduce your test case. CShell running ls always quits cleanly for me. There are no zombies in ps and no matter how many times I run it, they all clean up properly as I would expect. If there is a problem here, it has to originate in the VM not signalling the exit. Are you able to try again using VW7.8? I'd be interested in knowing if a change in the VM on OSX has fixed your problem.
>
> Michael
>
>


OK, I just d/l'd 7.8 and the problem persists for me.  I started up a clean 7.8 image under Snow Leopard on an iMac and the loop:

100 timesRepeat:
        [proc := ExternalProcess new.
        proc cshOne: 'ls'.
        proc wait]

consistently locks up in the #wait send.  In fact it pretty consistently locks up by the 2nd or 3rd loop iteration in a freshly started image.

David


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc