Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Troublesome app when scaling it up, how to proceed?



Trying to simply this to the known facts:

* Your app is running out of file-handles and failing. You know this because you modified the limit and it stops failing. Correct?

On 25 Oct 2007, at 10:28, Gerben Wierda wrote:

I cannot use DO for communication because I want to communicate with the
stdin, stdout, stderr of regular unix cli tools like file, tar, openssl,
gpg, perl, sh, etc.

* You're running a lot of sub-processes and connecting to them with pipes. At least 3 per process (stdout, stdin, stderr) and possibly more (+named ones for privileged processes).


If there would be an NSPrivilegedTask it would become a lot easier.

It might simplify your code, but it wouldn't solve your problem. That routine would still use file-handles to communicate. This is, I think, a red herring. If you are talking to stdin/out/err these are pipes however you connect to them, using Cocoa or not.


So the question is 'why aren't they closing?'

In this situation I would be using lsof to monitor the open file handles as the app runs. Something like

lsof -p <pid> -n +r 5

will show you all the open files of your process, and which ones are lasting longer than they should. Alternatively, using sharks 'System Trace' may help by allowing you to see what file-handles are used by what system call, and when they should have been released. That's not as easy to decode though.

I seem to remember something about pipes or sockets needing to be closed from both ends for them to be released, and the process just dying isn't enough. I've seen 'zombie' pipes hang around before (and get cleaned up after a while) and I think it was something like this. (This is from general Unix programming, nothing Mac specific)





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >Troublesome app when scaling it up, how to proceed? (From: Gerben Wierda <email@hidden>)
 >Re: Troublesome app when scaling it up, how to proceed? (From: David Spooner <email@hidden>)
 >Re: Troublesome app when scaling it up, how to proceed? (From: "Gerben Wierda" <email@hidden>)
 >Re: Troublesome app when scaling it up, how to proceed? (From: Thomas Engelmeier <email@hidden>)
 >Re: Troublesome app when scaling it up, how to proceed? (From: "Gerben Wierda" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.