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

Network failure in authentication treated as success, leading to null dereference #138

Open
mdpye opened this issue May 29, 2014 · 6 comments
Milestone

Comments

@mdpye
Copy link

mdpye commented May 29, 2014

See http://crashes.to/s/c83e37cf8ad

From my (naive) reading, connection:didFailWithError was called (frame 6), but no error object was passed, so the connectionError is assigned a null value. When calling finish (frame 5) the success branch is chosen, because it detects previous failure by testing connectionError, assuming that if it has been assigned it will have been assigned something non-null.

@lukeredpath
Copy link
Contributor

@mdpye looks like you might be right. Do you know what circumstances could have caused didFailWithError: to be called with a nil error? Perhaps PTURLRequestOperation should use a boolean flag to indicate failure rather than relying on the presence of an actual error - that should solve this issue.

Do you see this error a lot?

@mdpye
Copy link
Author

mdpye commented May 29, 2014

I'm afraid I don't know much about the circumstances - I'm working at Pusher, so I'm filing the report on behalf of someone who got in touch with support, don't have much visibility over their server logs for the period.

@lukeredpath
Copy link
Contributor

OK, let me know if something similar comes up. I'll try and get a fix for this in the next release.

@mdpye
Copy link
Author

mdpye commented May 29, 2014

Great, thank you.

@lukeredpath lukeredpath added this to the v1.6 milestone Jul 25, 2014
@adrianioancozma
Copy link

Hi there, I have encountered the same issue, app crash in libPusher w/ the same stack trace, w/ the same err message, when working w/ a server that uses to cough HTTP500 & binaries in JSONs from time to time.
For some unknown reasons, it appears more frequently on the release environment.
I've used a rapid fix which seems to be working in out tests:

PTPusherChannelAuthorizationOperation.m:71

- authorizationData = [[PTJSON JSONParser] objectFromJSONData:responseData];
+ authorizationData = (responseData==nil) ? nil : [[PTJSON JSONParser] objectFromJSONData:responseData];

@lukeredpath lukeredpath modified the milestones: v1.6, v1.6.1 Mar 3, 2015
@lukeredpath lukeredpath modified the milestones: v1.6.1, v1.6.2 Sep 29, 2015
@hamchapman
Copy link
Contributor

@lukeredpath is the fix above fine to be added to the library?

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

No branches or pull requests

4 participants