Skip to content

Use thread-safe map to track active plans.#2

Open
erikrozendaal wants to merge 1 commit intoampedandwired:masterfrom
erikrozendaal:deadlock-fix
Open

Use thread-safe map to track active plans.#2
erikrozendaal wants to merge 1 commit intoampedandwired:masterfrom
erikrozendaal:deadlock-fix

Conversation

@erikrozendaal
Copy link

Before whenever two or more plans started simultaneously a deadlock would occur, as each plan found the other already running.

This fix uses a thread-safe map to track the plan that currently holds the mutex. When the plan finishes the mutex is cleared. If a plan dies without clearing the mutex a plan awaiting the mutex will perform the cleanup instead.

The implementation does assume that the pre- and post-chain actions run in a single JVM. Hopefully this is actually true...

This fix has been running in our Bamboo installation for a while and works for us without deadlocks. This fixes issue #1.

Before whenever two or more plans started simultaneously a deadlock
would occur, as each plan found the other already running.

This fix uses a thread-safe map to track the plan that currently holds
the mutex. When the plan finishes the mutex is cleared. If a plan dies
without clearing the mutex a plan awaiting the mutex will perform the
cleanup instead.

The implementation does assume that the pre- and post-chain actions run
in a single JVM. Hopefully this is actually true...
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.

1 participant