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

OkHttp (used by UrlConnection) might start a new Thread when reading response #313

Closed
william-ferguson-au opened this issue Oct 8, 2015 · 11 comments

Comments

@william-ferguson-au
Copy link
Member

D/ACRA﹕ Connect to https://testapps.cloudant.com/acra-testapp/_design/acra-storage/_update/report
 09-28 22:35:09.235 16507-16536/? E/ACRA﹕ ACRA caught a InternalError for com.blogspot.test.testapp
 java.lang.InternalError: Thread starting during runtime shutdown
 at java.lang.Thread.nativeCreate(Native Method)
 at java.lang.Thread.start(Thread.java:1063)
 at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:921)
 at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1337)
 at com.android.okhttp.ConnectionPool.addConnection(ConnectionPool.java:208)
 at com.android.okhttp.ConnectionPool.recycle(ConnectionPool.java:198)
 at com.android.okhttp.OkHttpClient$1.recycle(OkHttpClient.java:111)
 at com.android.okhttp.internal.http.HttpConnection$AbstractSource.endOfInput(HttpConnection.java:377)
 at com.android.okhttp.internal.http.HttpConnection$FixedLengthSource.read(HttpConnection.java:426)
 at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:349)
 at java.io.InputStream.read(InputStream.java:162)
 at com.a.a.a.a.a(SourceFile:238)
 at com.a.a.a.a.a(SourceFile:123)
 at com.a.a.k.run(SourceFile:112)
@william-ferguson-au
Copy link
Member Author

Boiled up out of #307

@william-ferguson-au
Copy link
Member Author

OK, reported to OKHttp square/okhttp#1907 but they don't seem inclined to do anything about it.

So options are

  1. Use another library to send the requests
  2. No longer attempt to send when the crash happens. Only send on restart of the app.

Shortest path is option (2).

@william-ferguson-au
Copy link
Member Author

We run into this issue previously when ACRA itself was creating threads.
One of the solutions was to make sending reports at shutdown configurable #199.

I think we just change that so that reports are never sent at shutdown now.

@mkonecny
Copy link

Any update on this? At the present moment it appears ACRA 4.7 is broken when targeting API 23 (Marshmallow).

@william-ferguson-au
Copy link
Member Author

I'm totally snowed under at the moment, so I won't have a chance to get to it for a week or two at least.

@timrae
Copy link
Contributor

timrae commented Oct 17, 2015

One simple solution (though perhaps not the best) could be to revert 348b277 and use the updated Apache client instead, as I recently did in AnkiDroid and wrote about on stackoverflow .

ACRA 1.7 is broken now, so it would be good to get a quick fix out or at least remove the broken builds

@mkonecny
Copy link

@timrae I'm not so sure that's a great idea. One could simply put useLibrary 'org.apache.http.legacy' in their build.gradle if they want access to the deprecated apache libs.

@william-ferguson-au perhaps we could fix 4.7 with the shortcut number 2 option, and go with number 1 for 4.8.

@william-ferguson-au
Copy link
Member Author

@mkonecny I'm proposing that option (2) becomes the standard path going forward. But I don't have any time at all fotr this right now. If you want to follow the threads and provide a PR, I'll try to find time to review and mege.

@william-ferguson-au
Copy link
Member Author

OK, I've spent the last couple of hours on this and I can't replicate it.
Possibly it a version issue, so for the record I have been testing on 6.0

I'll leave this open for a day or two for people to provide input on a reliable scenario to reproduce the failure for OKHttp to send on device shutdown. If I get no response then I will close this issue and cut 4.7.0-RC.2

@william-ferguson-au
Copy link
Member Author

Closing this as as promised I have released 1.7.0-RC2.

@william-ferguson-au
Copy link
Member Author

NB this is being worked in #329

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

No branches or pull requests

3 participants