Crash when calling findAllRemote in rapid succession
Reported by Adam Alexander | February 10th, 2009 @ 06:02 AM | in ObjectiveResource 1.01
Good morning, I ran into this while working on a project with a refresh button: when performing findAllRemote too quickly in succession there is a random crash. Some of the messages I've received are as follows:
2009-02-10 05:02:49.037 App[4259:20b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSDecimalNumber view]: unrecognized selector sent to instance 0x10a4d70'
2009-02-10 05:06:22.138 App[4581:20b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSCFDictionary view]: unrecognized selector sent to instance 0x1086fb0'
2009-02-10 05:04:29.185 App[4325:20b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSCFSet removeObject:]: attempt to remove nil'
2009-02-10 05:26:35.701 App[4963:20b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSCFString count]: unrecognized selector sent to instance 0x5361b0'
2009-02-10 05:41:55.301 objective_resource[5894:20b] Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: ' -[NSCFString view]: unrecognized selector sent to instance 0xa029d6a0'
To be sure this was not just an issue in my code I added a refresh button to your example app and verified the same result. I made this change available in a personal commit here:
http://github.com/adamalex/objec...
If you take this change just load the example app with some data and double-click the refresh button once or twice and you should see the crash.
I did try to implement some thread safety in my app a couple different ways but no matter what I did on my side to ensure my calls weren't stepping on each other I received the same result. Please feel free to let me know if there is any additional information I can provide, thanks very much for your time.
Comments and changes to this ticket
-
Joshua Vickery February 10th, 2009 @ 08:01 AM
- Assigned user set to Joshua Vickery
-
Ryan Daigle February 10th, 2009 @ 11:15 AM
(from [dc4fe44dd1338ede2e642e86fa5da20fd22d6ec2]) [#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode http://github.com/yfactorial/obj...
-
Ryan Daigle February 10th, 2009 @ 12:29 PM
(from [949e4dc87d9e60ad1265465fa0d67874301c0786]) Revert "[#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode"
This reverts commit dc4fe44dd1338ede2e642e86fa5da20fd22d6ec2.
It looks like NSURLConnection needs to run in the default mode, or it will exit immediately. http://github.com/yfactorial/obj...
-
Joshua Vickery February 10th, 2009 @ 12:36 PM
This is quite the pain. It looks like the problem is with the async NSURLConnection code and events firing in the main runloop. It doesn't seem to be crash within ObjectiveResource, but rather somewhere within the SDK.
I guess the solution is to figure out a different way to handle the async requests.
-
Adam Alexander February 10th, 2009 @ 01:22 PM
I did run across this post from an Apple engineer which provides some sample code:
https://devforums.apple.com/mess...
It looks very similar to what you guys are already doing but since there are a couple minor differences, maybe that would be the key? Hope it turns out to be useful...
-
Ryan Daigle February 10th, 2009 @ 03:59 PM
(from [7573de144e550f23f0a6b0a1b648653581bb53b6]) [#39] brilliant find Adam! using a custom run loop mode seems to take care of this problem http://github.com/yfactorial/obj...
-
Joshua Vickery February 10th, 2009 @ 04:02 PM
- Milestone set to ObjectiveResource 1.01
- Assigned user changed from Joshua Vickery to jjburka
Looks like this is fixed, many thanks to Adam.
James, I updated Harvest to use this latest version, so it looks like it handles the background HTTP processing as we need it to.
-
Adam Alexander February 10th, 2009 @ 09:38 PM
I can confirm that after getting the latest source the crash is completely eliminated in my local project as well! Just in case, I should point out that a side effect of this change seems to have been a reduction of the asynchronous-ness of the remote connection. I say this because it seems UI changes such as updating a status label or activating a UIActivityIndicatorView, when done immediately before calling findAllRemote, do not take effect until after the connection has completed. This is not a complaint at all, I can work around it in my code but I just wanted to point it out to you in case that had gone unnoticed.
-
Joshua Vickery February 12th, 2009 @ 02:21 PM
Ah yes, the original implementation kept the UI responsive while the server communication was going on, but this one doesn't.
Still, it's probably better to have to wrap calls from the UI thread up in a "peformSelector:afterDelay:" call than to have the app blow up.
-
Adam Alexander February 12th, 2009 @ 03:09 PM
Very true, also I forgot to mention before that I have noticed a significant performance improvement since this fix was implemented. Network operations and unit tests all seem to run much faster, so that's more good news.
It seems there are a few different (sometimes competing) goals that would all be nice to have:
- Excellent performance
- Simple syntax for client code
- Responsive UI during network operations
- Not blowing up
This latest commit improved #1 and fixed #4 at the expense of #3. Like you said above, we have the option to gain #3 back by sacrificing #2 a little. I'm going to try a few different things to see what works the best in my current project (which happens to represent a good example of a relatively standard use case for ObjectiveResource) and will let you guys know what I come up with, either in terms of client code patterns or opportunities to further update OR to give us even more of the 4 qualities above.
-
Ryan Daigle February 17th, 2009 @ 01:49 PM
(from [ce5e0577391c706fc2ecd6b9d61f90fef698f66d]) Merge branch 'master' of git@github.com:yfactorial/objectiveresource
- 'master' of git@github.com:yfactorial/objectiveresource: [#39] brilliant find Adam! using a custom run loop mode seems to take care of this problem Revert "[#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode" [#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode Added refresh button to People View http://github.com/yfactorial/obj...
-
Ryan Daigle February 17th, 2009 @ 01:49 PM
(from [ce5e0577391c706fc2ecd6b9d61f90fef698f66d]) Merge branch 'master' of git@github.com:yfactorial/objectiveresource
- 'master' of git@github.com:yfactorial/objectiveresource: [#39] brilliant find Adam! using a custom run loop mode seems to take care of this problem Revert "[#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode" [#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode Added refresh button to People View http://github.com/yfactorial/obj...
-
Ryan Daigle February 17th, 2009 @ 01:49 PM
(from [ce5e0577391c706fc2ecd6b9d61f90fef698f66d]) Merge branch 'master' of git@github.com:yfactorial/objectiveresource
- 'master' of git@github.com:yfactorial/objectiveresource: [#39] brilliant find Adam! using a custom run loop mode seems to take care of this problem Revert "[#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode" [#39] run the NSURLConnection in the NSConnectionReplyMode rather than the NSDefaultRunLoopMode Added refresh button to People View http://github.com/yfactorial/obj...
-
jjburka February 18th, 2009 @ 12:37 PM
- State changed from new to resolved
-
Adam Alexander March 1st, 2009 @ 02:49 PM
As promised (threatened?) I have come up with some additional thoughts and ideas about this and posted them to a discussion I found at oup/objectiveresource/browse_thread/thread/87393e897ae16c05/f31161c822eccfd4?hl=en#f31161c822eccfd4 since the crash reported in this ticket is already resolved. Thanks in advance for any direction you can provide =)
-
JulietOdom34 October 1st, 2010 @ 01:45 PM
- Assigned user cleared.
- Milestone order changed from 0 to 0
After dip into this column I get a lot on how to create articles. As a graduate, I have nevercompleted one regular assignment and always use dissertation help. What a shame! But now I have cool in writing. Thank you.
-
Debby Smith October 25th, 2019 @ 07:57 AM
First, make sure you place your test crashing code in a different place than applicationDidFinishLaunching. This is only for testing -- Crashlytics will detect crashes in your applicationDidFinishLaunching method. A good place could be a button action. There is so much to be learnt about it. So better concentrate on it rather than on writing your dissertation abstracts online.
-
abc efg March 20th, 2020 @ 03:00 AM
Our academic pursuits, along with a range of extracurricular activities, help in honing a child's skills and ensuring that he/she grows to be a mature and responsible citizen.
best school in greater noida
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป
Port of Rails' ActiveResource framework to the iPhone.
People watching this ticket
Referenced by
- 39 Crash when calling findAllRemote in rapid succession (from [dc4fe44dd1338ede2e642e86fa5da20fd22d6ec2]) [#39] r...
- 39 Crash when calling findAllRemote in rapid succession (from [949e4dc87d9e60ad1265465fa0d67874301c0786]) Revert ...
- 39 Crash when calling findAllRemote in rapid succession (from [7573de144e550f23f0a6b0a1b648653581bb53b6]) [#39] b...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 39 Crash when calling findAllRemote in rapid succession 'master' of git@github.com:yfactorial/objectiveresource: ...
- 57 async connection manager From #39 Adam Alexander