Re: Too many threads?

2013-05-08 Thread Seth Willits
On May 8, 2013, at 3:03 PM, Rainer Standke wrote:

> When the crashes happen the has something like 2000 threads going, according 
> to Activity Monitor, and all the Free RAM is used up.

Even with 6 renders going on in parallel there's no way you should have 2000 
threads. Something you're doing must be spawning endless threads.



--
Seth Willits




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Too many threads?

2013-05-08 Thread Stephen J. Butler
If that's a POSIX error code it's reporting, then 35 maps to either EAGAIN
or EWOULDBLOCK.

I thought it might be you're hitting the max file limit (256 by default)
but that would cause open() to return EMFILE. However, pthread_create() can
return EAGAIN, and with 2000+ threads you might be hitting this limit:

"The system lacked the necessary resources to create another thread, or the
system-imposed limit on the total number of threads in a process
[PTHREAD_THREADS_MAX] would be exceeded."


On Wed, May 8, 2013 at 5:03 PM, Rainer Standke  wrote:

> Hello all,
>
> I have an app that's rendering QuickTime movies based on AVFoundation.
> It's multi-threaded via GCD, and has up 6 renders going at the same time.
>
> I am getting un-explained crashes, or at least I can't explain them. The
> crashing thread is usually something deep in AVFoundation. I get things
> like this one: "AVAssetWriterStatusFailed - An unknown error occurred (35)
> - The operation could not be completed"
>
> When the crashes happen the has something like 2000 threads going,
> according to Activity Monitor, and all the Free RAM is used up.
>
> As a crutch I have implemented a throttling mechanism that basically waits
> a number of seconds before starting the next render - but it feels kludgy,
> and the app can still crash.
>
> My question is, besides properly releasing objects etc, is there any thing
> I can do to keep the number of threads down, or cause the system to spin
> down threads that aren't needed any more?
>
> Thanks for any pointers,
>
> Rainer
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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:
>
> https://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com
>
> This email sent to stephen.but...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Too many threads?

2013-05-08 Thread John Randolph

On May 8, 2013, at 3:03 PM, Rainer Standke  wrote:

> When the crashes happen the has something like 2000 threads going, according 
> to Activity Monitor, and all the Free RAM is used up.

Running out of RAM is probably the cause.  It wouldn't surprise me at all to 
see crashes in framework code when some allocation it tries to do fails.

Why are you spawning so many threads?

-jcr
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Too many threads?

2013-05-08 Thread Rainer Standke
Hello all,

I have an app that's rendering QuickTime movies based on AVFoundation. It's 
multi-threaded via GCD, and has up 6 renders going at the same time.

I am getting un-explained crashes, or at least I can't explain them. The 
crashing thread is usually something deep in AVFoundation. I get things like 
this one: "AVAssetWriterStatusFailed - An unknown error occurred (35) - The 
operation could not be completed"

When the crashes happen the has something like 2000 threads going, according to 
Activity Monitor, and all the Free RAM is used up.

As a crutch I have implemented a throttling mechanism that basically waits a 
number of seconds before starting the next render - but it feels kludgy, and 
the app can still crash.

My question is, besides properly releasing objects etc, is there any thing I 
can do to keep the number of threads down, or cause the system to spin down 
threads that aren't needed any more?

Thanks for any pointers,

Rainer
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com