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

DataFetcher#cancel() should be called on a background thread #278

Closed
sjudd opened this issue Nov 24, 2014 · 5 comments
Closed

DataFetcher#cancel() should be called on a background thread #278

sjudd opened this issue Nov 24, 2014 · 5 comments
Assignees
Labels

Comments

@sjudd
Copy link
Collaborator

sjudd commented Nov 24, 2014

OkHttp and HttpUrlConnection both trigger strict mode violations when cancel is called on the main thread (See #257, and the TODO in HttpUrlFetcher).

@TWiStErRob
Copy link
Collaborator

@sjudd this seems to be fixed on your branch, did you forget to merge it?

@sjudd
Copy link
Collaborator Author

sjudd commented Oct 15, 2015

I tried, but it causes issues with OkHttp. At least that (now relatively old) version of OkHttp seemed to get into a bad state after a few async cancellations of in process requests.

@floating-cat
Copy link
Contributor

OkHttp fixes this issue in v2.7.0.
OkHttp now detects and warns on connections that were allocated but never released, and will enforce HTTP/2 stream limits. This update also fixes Call.cancel() to not do I/O on the calling thread.

https://github.com/square/okhttp/blob/master/CHANGELOG.md
square/okhttp#1592

@TWiStErRob
Copy link
Collaborator

@floating-cat thanks! Glide master is currently on okhttp-2.3.0.
@sjudd If we update it to 2.7.0 and add the cancel call in the integration lib, we can fix #257, but not this issue. Some hacky version detection may also be needed to no try to cancel when an older version of OkHttp is forced on the classpath.

@sjudd
Copy link
Collaborator Author

sjudd commented Sep 9, 2017

Obsolete with okhttp3 and v4

@sjudd sjudd closed this as completed Sep 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants