Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

AsyncTask race conditions for remote push/pull #272

Closed
eisbehr opened this Issue · 0 comments

2 participants

@eisbehr

When working on the file revision check feature I noticed a race condition bug with the AsyncTask class we are using. This could be responsible for a lot of the weirdness we are experiencing when syncing.

When this app was first started it was (probably) written with Android 1.5 in mind, now the target version is 1.6. The AsyncTask changed its behavior from 1.5 to 1.6. In 1.5 it did what we wanted it to do, it used one background thread for all AsyncTask instances and queued the tasks to finish them one after another. Starting with 1.6 this changed. Now all AsyncTasks run in their own thread and in parallel. This makes our app push to and pull from remote in a non synchronized way, depending on the network connection this can cause unwanted outcomes.

With revision checks this should no longer give us blind overwrites of remote or local tasks, but it is still cause for a lot of bugginess.

We'll need to look at a way to make our asynchronous syncing tasks queued again.

UPDATE:
From the Android Docs:

When first introduced, AsyncTasks were executed serially on a single background thread. Starting with DONUT, this was changed to a pool of threads allowing multiple tasks to operate in parallel. Starting with HONEYCOMB, tasks are executed on a single thread to avoid common application errors caused by parallel execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.