Skip to content

Conversation

@mig35
Copy link

@mig35 mig35 commented Jun 3, 2014

Outer try/catch block can break post logic.
Steps:
BG thread execute
"return" inside synchronized block, but not execute finally block. So
executorRunning is false.
An other thread are in synchronized block of
enqueue, check executorRunning (it is false) and make it true.
Then BG
thread execute finally section and changes executorRunning to false.
So
any other calls to enqueue will start this runnable again in
executor.
This pull request fixes this bug and restart thread if it ends
by interrupt.

Outer try/catch block can break post logic.
Steps:
BG thread execute
"return" inside synchronized block, but not execute finally block. So
executorRunning is false.
An other thread are in synchronized block of
enqueue, check executorRunning (it is false) and make it true.
Then BG
thread execute finally section and changes executorRunning to false.
So
any other calls to enqueue will start this runnable again in
executor.
This pull request fixes this bug and restart thread if it ends
by interrupt.
@greenrobot
Copy link
Owner

Is this something theoretical or did you experience this in practice? Interrupting a a thread will be hard in this scenario. Also, do you have a unit test for this?

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

Successfully merging this pull request may close these issues.

2 participants