KhronosGroup / KhronosGroup/SYCL_Reference

Potential race condition with GitHub actions

Open
#185 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
31
Forks
26
PR merge metrics
No merged PRs in 30d

Description

I think there is a potential race condition with the "'publish-pages" job I added to GitHub actions in #184.

The danger occurs when there are multiple pushes (i.e. merged PRs) to the "main" branch in close succession. I added `concurrency` to the publishing job to prevent overlapping deployments to the web site. I think this makes sense because overlapping deployments could interfere with one another, causing corruption to the deployed web content.

However, there is no guarantee that the latest push will be published. Consider the following scenario when two PRs are merged in close succession:

* PR 1 is merged first, GitHub actions starts running
* PR 2 is merged next, GitHub actions starts running
* PR 2 happens to reach the "publish-pages" job first, and deploys
* PR 1 waits for PR 2 to complete, and then it executes "publish-pages"

As a result, changes from PR 2 are not published to the web site.

It seems like this could be fixed by adding an `if` condition to the "publish-pages" job which skips the job unless the SHA of the "push" event that triggers the workflow is currently the head of the "main" branch.

I'm not much of an expert in GitHub actions. @oddhack or @outofcontrol do you happen to know this stuff better? Is the solution I suggest the right way to fix this?

Contributor guide

No contributing guide indexed for this repository

Research direction

Find the GitHub Actions workflow containing the "publish-pages" job and review its concurrency settings and the push event SHA. Verify that publishing is skipped when the triggering SHA is no longer the head of main, then test the behavior with closely successive pushes or workflow runs.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions
Domain
ci-cd
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.