Skip to content

Conversation

@iaindillingham
Copy link
Member

Giving the concurrency group the same name as a job is confusing, especially when the concurrency group applies to the workflow. Thanks for pointing this out, @alarthast. Naming things is hard, so we rename the concurrency group by adding the suffix "-group".


Also, a correction: in 7bbff4e I said that GitHub doesn't queue runs. I was mistaken: a workflow concurrency group can have a queue of one. In other words, two instances of a workflow in the same concurrency group are permitted: the first is running and the second is pending. The docs are not as clear as they could be, because "running" has both a specific meaning (the running state) and a general meaning (the running state and the pending state could both be described as running). In addition, the docs for workflow concurrency (concurrency) also describe job concurrency (jobs.<job_id>.concurrency).

Giving the concurrency group the same name as a job is confusing,
especially when the concurrency group applies to the workflow. Thanks
for pointing this out, @alarthast. Naming things is hard, so we rename
the concurrency group by adding the suffix "-group".
@iaindillingham iaindillingham merged commit 48cef93 into main Mar 5, 2025
1 check passed
@iaindillingham iaindillingham deleted the iaindillingham/race-condition branch March 5, 2025 14:44
iaindillingham added a commit to opensafely-actions/cohort-joiner that referenced this pull request Mar 5, 2025
If two commits are merged to `main`, each will trigger a separate run of
the CI workflow. If, for some reason, the later commit's run completes
first, then the later commit will be tagged with the next version
number. The earlier commit, whose run completes second, will also be
tagged with the next version number, but the earlier commit's version
number will be greater than the later commit's version number, which is
very confusing.

This is known as a _race condition_. To prevent it, we should ensure
that runs are executed in sequence. To do so, we should set [the
workflow's `concurrency` property][1]. See:

* opensafely-actions/kaplan-meier-function#25
* opensafely-actions/kaplan-meier-function#27

[1]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
iaindillingham added a commit to opensafely-actions/cohort-report that referenced this pull request Mar 5, 2025
If two commits are merged to `main`, each will trigger a separate run of
the CI workflow. If, for some reason, the later commit's run completes
first, then the later commit will be tagged with the next version
number. The earlier commit, whose run completes second, will also be
tagged with the next version number, but the earlier commit's version
number will be greater than the later commit's version number, which is
very confusing.

This is known as a _race condition_. To prevent it, we should ensure
that runs are executed in sequence. To do so, we should set [the
workflow's `concurrency` property][1]. See:

* opensafely-actions/kaplan-meier-function#25
* opensafely-actions/kaplan-meier-function#27

[1]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
iaindillingham added a commit to opensafely-actions/dataset-report that referenced this pull request Mar 5, 2025
If two commits are merged to `main`, each will trigger a separate run of
the CI workflow. If, for some reason, the later commit's run completes
first, then the later commit will be tagged with the next version
number. The earlier commit, whose run completes second, will also be
tagged with the next version number, but the earlier commit's version
number will be greater than the later commit's version number, which is
very confusing.

This is known as a _race condition_. To prevent it, we should ensure
that runs are executed in sequence. To do so, we should set [the
workflow's `concurrency` property][1]. See:

* opensafely-actions/kaplan-meier-function#25
* opensafely-actions/kaplan-meier-function#27

[1]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
iaindillingham added a commit to opensafely-actions/project-dag that referenced this pull request Mar 6, 2025
If two commits are merged to `main`, each will trigger a separate run of
the CI workflow. If, for some reason, the later commit's run completes
first, then the later commit will be tagged with the next version
number. The earlier commit, whose run completes second, will also be
tagged with the next version number, but the earlier commit's version
number will be greater than the later commit's version number, which is
very confusing.

This is known as a _race condition_. To prevent it, we should ensure
that runs are executed in sequence. To do so, we should set [the
workflow's `concurrency` property][1]. See:

* opensafely-actions/kaplan-meier-function#25
* opensafely-actions/kaplan-meier-function#27

[1]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
iaindillingham added a commit to opensafely-actions/demographic-standardisation that referenced this pull request Mar 6, 2025
If two commits are merged to `main`, each will trigger a separate run of
the CI workflow. If, for some reason, the later commit's run completes
first, then the later commit will be tagged with the next version
number. The earlier commit, whose run completes second, will also be
tagged with the next version number, but the earlier commit's version
number will be greater than the later commit's version number, which is
very confusing.

This is known as a _race condition_. To prevent it, we should ensure
that runs are executed in sequence. To do so, we should set [the
workflow's `concurrency` property][1]. See:

* opensafely-actions/kaplan-meier-function#25
* opensafely-actions/kaplan-meier-function#27

[1]: https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency
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