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

Crash: java.util.ConcurrentModificationException #15

Closed
murraycu opened this Issue Jan 16, 2015 · 2 comments

Comments

Projects
None yet
1 participant
@murraycu
Copy link
Owner

murraycu commented Jan 16, 2015

I've seen one crash report with this stacktrace, though the stacktrace is rather hard to understand. Maybe the retrace (in proguardgui) failed somehow.

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.util.ConcurrentModificationException
at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:573)
at com.murrayc.galaxyzoo.app.QuestionFragment.android.view.View onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)(Unknown Source)
                                              void onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)
                                              void onPrepareOptionsMenu(android.view.Menu)
                                              boolean onOptionsItemSelected(android.view.MenuItem)
                                              void onAttach(android.app.Activity)
                                              android.widget.TableRow addRowToTable(android.app.Activity,android.widget.TableLayout)
                                              void insertButtonInRow(android.content.Context,android.widget.TableRow,android.view.View)
                                              android.widget.Button createAnswerButton(android.app.Activity,com.murrayc.galaxyzoo.app.DecisionTree$Answer)
                                              void onAnswerButtonClicked(java.lang.String,java.lang.String)
                                              void saveClassificationSync(com.murrayc.galaxyzoo.app.QuestionFragment$ClassificationInProgress)
                                              android.support.v4.content.Loader onCreateLoader(int,android.os.Bundle)
                                              void onLoadFinished(android.support.v4.content.Loader,android.database.Cursor)
                                              void onLoaderReset(android.support.v4.content.Loader)
                                              void onLoadFinished(android.support.v4.content.Loader,java.lang.Object)
                                              void access$000(com.murrayc.galaxyzoo.app.QuestionFragment,java.lang.String,java.lang.String)
                                              void access$100(com.murrayc.galaxyzoo.app.QuestionFragment,com.murrayc.galaxyzoo.app.QuestionFragment$ClassificationInProgress)
                                              void access$200(com.murrayc.galaxyzoo.app.QuestionFragment)
at com.murrayc.galaxyzoo.app.QuestionFragment.android.view.View onCreateView(android.view.LayoutInflater,android.view.ViewGroup,android.os.Bundle)(Unknown Source)
                                              void onCreateOptionsMenu(android.view.Menu,android.view.MenuInflater)
                                              void onPrepareOptionsMenu(android.view.Menu)
                                              boolean onOptionsItemSelected(android.view.MenuItem)
                                              void onAttach(android.app.Activity)
                                              android.widget.TableRow addRowToTable(android.app.Activity,android.widget.TableLayout)
                                              void insertButtonInRow(android.content.Context,android.widget.TableRow,android.view.View)
                                              android.widget.Button createAnswerButton(android.app.Activity,com.murrayc.galaxyzoo.app.DecisionTree$Answer)
                                              void onAnswerButtonClicked(java.lang.String,java.lang.String)
                                              void saveClassificationSync(com.murrayc.galaxyzoo.app.QuestionFragment$ClassificationInProgress)
                                              android.support.v4.content.Loader onCreateLoader(int,android.os.Bundle)
                                              void onLoadFinished(android.support.v4.content.Loader,android.database.Cursor)
                                              void onLoaderReset(android.support.v4.content.Loader)
                                              void onLoadFinished(android.support.v4.content.Loader,java.lang.Object)
                                              void access$000(com.murrayc.galaxyzoo.app.QuestionFragment,java.lang.String,java.lang.String)
                                              void access$100(com.murrayc.galaxyzoo.app.QuestionFragment,com.murrayc.galaxyzoo.app.QuestionFragment$ClassificationInProgress)
                                              void access$200(com.murrayc.galaxyzoo.app.QuestionFragment)
at com.murrayc.galaxyzoo.app.QuestionFragment$SaveClassificationTask.java.lang.Void doInBackground(java.lang.Void[])(Unknown Source)
                                                                     void onPostExecute(java.lang.Void)
at com.murrayc.galaxyzoo.app.QuestionFragment$SaveClassificationTask.java.lang.Object doInBackground(java.lang.Object[])(Unknown Source)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)

murraycu added a commit that referenced this issue Jan 16, 2015

QuestionFragment.ClassificationInProgress: Do some defensive copying.
Return copies of lists and copy lists in constructors.
This is to avoid concurrent changes when, for instance, the answers
List changes while we are iterating over it. It's not clear when that
might happen, but we call getAnswers() from AsyncTask(), so it seems
possible. There is at least one report of a ConcurrentModificationException
so this might help:
#15
@murraycu

This comment has been minimized.

Copy link
Owner

murraycu commented Jan 16, 2015

This might help:
b938717

murraycu added a commit that referenced this issue Jan 17, 2015

QuestionFragment.ClassificationInProgress: Do some defensive copying.
Return copies of lists and copy lists in constructors.
This is to avoid concurrent changes when, for instance, the answers
List changes while we are iterating over it. It's not clear when that
might happen, but we call getAnswers() from AsyncTask(), so it seems
possible. There is at least one report of a ConcurrentModificationException
so this might help:
#15
@murraycu

This comment has been minimized.

Copy link
Owner

murraycu commented Jan 17, 2015

And this might help too:
60bcad3

@murraycu murraycu closed this Jan 17, 2015

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