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
We shouldn't be using NSBundle as much as we are (not thread safe) #1861
Comments
P.S. I think I've hit the nail on my head with my last comment:
Looking at the crash reports, about 60% of our crashes come from something to do with |
I’m pretty sure it’s in 1.1.x too, but I’m OK with holding up 1.2.0 if it fixes 60% of the crashes. I knew it wasn’t thread safe from one of Mike Ash’s Friday Q&A’s, but wasn’t sure of it was causing us any problems or what to do about it. Do you think all icon loading needs to be on the same thread, or just the |
From that crash I've posted, probably just the Does it all need to be on the same thread? Probably not. Should the code be running on a high priority queue? Definitely not. Should we be using Some stats: For 400B: If you expand the
An example of a crash unrelated to NSBundle (I'm pretty sure the high-priority thread 4 is also loading an icon:
|
I've thrown together a simple proof of concept of this. It shows that it's not as easy as I thought. There are so many threading issues with QSObject (esp. in That branch works, but icon loading is obviously slow |
Sorry for the bombardment... perhaps another solution (which I don't think will fix everything) is to use |
I would be happy to help with whatever solution is chosen - I've got a good bit of experience with GCD. Your solution looks appropriate, @pjrobertson. What specifically is the issue regarding icon loading on multiple threads? Do they just need to synchronize at a specific point, or does the loading itself need to be completely isolated to a single thread? Using Do you see better performance by specifying a custom priority for your serial queue? (Using Edit: Tweaking the serial queue to run on the high-priority global queue, I see no difference in performance. |
Hi @craigotis I appreciate the offer of help :) The issue regarding icon loading and multiple threads... I'm not entirely sure :(
Also see this so you can see, the primary issue is using non thread-safe methods on a background thread ( Thoughts on the best way of making or calls to |
Making QSResourceManager work on a single thread is probably the way to go. Perhaps we should make |
See my new pull request, hopefully you'll agree that that is sufficient? |
NSBundle is not thread safe, I've just seen a crash because of it.
Of interest is: http://code.google.com/p/chromium/issues/detail?id=24842
We use it in so many places I know it'll be difficult to root out.
Maybe in this case the real solution is to make sure that all images are loaded on the same thread.
The text was updated successfully, but these errors were encountered: