Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deadlock #398

Closed
xissburg opened this issue Oct 10, 2015 · 14 comments · Fixed by #429
Closed

Deadlock #398

xissburg opened this issue Oct 10, 2015 · 14 comments · Fixed by #429

Comments

@xissburg
Copy link

I have no idea how and why this is happening but it's happening. Quite frequently now. It happens in different places, in different situations. I don't know an exact sequence of steps to reproduce. Here's a full backtrace: https://gist.github.com/xissburg/a65549d78abbe0a8572f

I am just accessing a PFObject property and the deadlock happens.

@nlutsenko
Copy link
Contributor

Hey @xissburg, thanks for the report. Stack trace here is definetly helpful.
From symbol names in the stack trace - I can see that you are using a quite old version of the SDK.
Any chance you can update to the latest one and retest? (at the time of writing this is 1.9.0).
We had few fixes around deadlocks in few recent releases.

@nlutsenko nlutsenko self-assigned this Oct 10, 2015
@xissburg
Copy link
Author

It looks like I will have to upgrade my project to Swift 2 and Xcode 7 first.

@nlutsenko
Copy link
Contributor

I am almost sure everything is still going to work on Swift 1.2 and Xcode 6.4 with the current latest version, but let me know if it doesn't.

@xissburg
Copy link
Author

I get the same problem described in this issue #298.

@kevflynn
Copy link

I'm getting lots of Deadlocking as well. Next time I replicate, I'll post a stacktrace.

@kevflynn
Copy link

Here's the stack trace - https://gist.github.com/kevflynn/3deb9da4628a48e49ec0

@richardjrossiii
Copy link
Contributor

Thanks for the trace. Any chance you can post the output from all threads (thread bt all) in the lldb console.

@kevflynn
Copy link

@rudywen
Copy link

rudywen commented Oct 14, 2015

I'm also seeing similar deadlock issues. Here is the BT: https://gist.github.com/rudywen/31ec2f54574be20784ab

This issue is blocking our app release. Is there anything we can do to help debug the issue?

@richardjrossiii
Copy link
Contributor

@rudywen That deadlock is actually not directly Parse's fault. What's happening here is that every thread in the default thread pool (usually there's 16 threads in the thread pool for iOS/OSX) is waiting on a task to be run in the same thread pool (in this case, it's attempting to create the PFFIle cache directory if necessary), but because all thread pools are going attempting to wait on the same thing at the same time, there's no thread available from the system to attempt to create the directory.

You should probably rethink your architecture if you're trying to concurrently download so many parse files, or use your own network/caching stack using file.url, as the architecture in Parse is not designed for so many concurrent downloads.

@nlutsenko
Copy link
Contributor

@richardjrossiii is right on this one, it's purely too many files being downloaded at the same time.
We can optimize for it, but in all sanity - please simply add the file downloads to an operation queue, as downloading ~30 files concurrently is probably not what you want.

@rudywen
Copy link

rudywen commented Oct 14, 2015

@richardjrossiii @nlutsenko Thanks for the suggestions. We'll correct it on our end.

richardjrossiii added a commit that referenced this issue Oct 16, 2015
We didn't actually need to hold the lock here, and if we did, another thread could have acquired these locks in another order, causing a deadlock.

Should help to fix #398, #11, and a few others.
richardjrossiii added a commit that referenced this issue Oct 16, 2015
We didn't actually need to hold the lock here, and if we did, another thread could have acquired these locks in another order, causing a deadlock.

Should help to fix #398, #11, and a few others.
@xissburg
Copy link
Author

After upgrading to Parse 1.9.0 I haven't experienced this issue again. Thanks for the great job guys!

@nlutsenko
Copy link
Contributor

Glad it helped!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants