android-async-http / android-async-http/android-async-http

ConcurrentModificationException

Open
#1,182 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
10.6k
Forks
4k
PR merge metrics
No merged PRs in 30d

Description

I'm using this latest version of library in my project and I get a "ConcurrentModificationException".
Exception occurs at line 1578 in this class
https://github.com/loopj/android-async-http/blob/master/library/src/main/java/com/loopj/android/http/AsyncHttpClient.java

Here is the stacktrace

1.
java.util.ConcurrentModificationException at java.util.LinkedList$LinkIterator.next(LinkedList.java:124) at com.loopj.android.http.AsyncHttpClient.sendRequest(AsyncHttpClient.java:1526) at com.loopj.android.http.AsyncHttpClient.post(AsyncHttpClient.java:1169) at com.akamai.android.sdk.internal.e$1.run(Unknown Source) at java.lang.Thread.run(Thread.java:818)

A little bit digging into the issue shows that we have to synchronize the process of iterating the list.

Check out https://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#synchronizedList(java.util.List)
http://stackoverflow.com/a/9468307/3701433

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.