fix: the configuration must not be used as temporary storage #849

Merged
earl-warren merged 1 commit from earl-warren/runner:wip-valid-volumes into main 2025-08-12 10:09:43 +00:00
Contributor

rc.Config should be treated as read-only and not as a temporary storage for the variable list of valid volumes for containers sharing this configuration.

Refs forgejo/runner#848

  • bug fixes
    • PR: fix: the configuration must not be used as temporary storage
rc.Config should be treated as read-only and not as a temporary storage for the variable list of valid volumes for containers sharing this configuration. Refs forgejo/runner#848 <!--start release-notes-assistant--> <!--URL:https://code.forgejo.org/forgejo/runner--> - bug fixes - [PR](https://code.forgejo.org/forgejo/runner/pulls/849): <!--number 849 --><!--line 0 --><!--description Zml4OiB0aGUgY29uZmlndXJhdGlvbiBtdXN0IG5vdCBiZSB1c2VkIGFzIHRlbXBvcmFyeSBzdG9yYWdl-->fix: the configuration must not be used as temporary storage<!--description--> <!--end release-notes-assistant-->
earl-warren force-pushed wip-valid-volumes from f9a509e752
Some checks failed
/ cascade (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / build and test (pull_request) Successful in 44s
checks / runner exec tests (pull_request) Successful in 24s
act / unit (pull_request) Successful in 2m26s
act / integration (pull_request) Failing after 8m6s
to 28d0a596a9
All checks were successful
/ cascade (pull_request_target) Has been skipped
checks / build and test (pull_request) Successful in 37s
checks / runner exec tests (pull_request) Successful in 21s
act / unit (pull_request) Successful in 1m24s
act / integration (pull_request) Successful in 9m26s
issue-labels / release-notes (pull_request_target) Successful in 5s
2025-08-11 23:48:45 +00:00
Compare
Author
Contributor

It is unclear if this is the root cause of #848, but is certainly is a source of problems.

It is unclear if this is the root cause of https://code.forgejo.org/forgejo/runner/issues/848, but is certainly is a source of problems.
earl-warren changed title from WIP: fix: the configuration must not be used as temporary storage [skip cascade] to fix: the configuration must not be used as temporary storage [skip cascade] 2025-08-12 00:02:07 +00:00
Author
Contributor

this might fix the rather frequent (once every 5 or 10 runs at least) false negative from #848

this might fix the rather frequent (once every 5 or 10 runs at least) false negative from https://code.forgejo.org/forgejo/runner/issues/848
earl-warren force-pushed wip-valid-volumes from 28d0a596a9
All checks were successful
/ cascade (pull_request_target) Has been skipped
checks / build and test (pull_request) Successful in 37s
checks / runner exec tests (pull_request) Successful in 21s
act / unit (pull_request) Successful in 1m24s
act / integration (pull_request) Successful in 9m26s
issue-labels / release-notes (pull_request_target) Successful in 5s
to 82cf344f51
All checks were successful
/ cascade (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / build and test (pull_request) Successful in 43s
checks / runner exec tests (pull_request) Successful in 34s
act / unit (pull_request) Successful in 1m53s
act / integration (pull_request) Successful in 16m0s
2025-08-12 00:03:39 +00:00
Compare
earl-warren changed title from fix: the configuration must not be used as temporary storage [skip cascade] to fix: the configuration must not be used as temporary storage 2025-08-12 00:04:02 +00:00
earl-warren force-pushed wip-valid-volumes from 82cf344f51
All checks were successful
/ cascade (pull_request_target) Has been skipped
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / build and test (pull_request) Successful in 43s
checks / runner exec tests (pull_request) Successful in 34s
act / unit (pull_request) Successful in 1m53s
act / integration (pull_request) Successful in 16m0s
to 3ab438ae41
All checks were successful
issue-labels / release-notes (pull_request_target) Successful in 6s
checks / build and test (pull_request) Successful in 47s
checks / runner exec tests (pull_request) Successful in 30s
act / unit (pull_request) Successful in 2m8s
act / integration (pull_request) Successful in 16m21s
/ cascade (pull_request_target) Successful in 10s
2025-08-12 00:04:09 +00:00
Compare
Contributor

cascading-pr updated at actions/setup-forgejo#592

cascading-pr updated at https://code.forgejo.org/actions/setup-forgejo/pulls/592
Owner

It seems

ValidVolumes []string // only volumes (and bind mounts) in this slice can be mounted on the job container or service containers

can be removed as well?

It seems https://code.forgejo.org/forgejo/runner/src/commit/555b322ce5922942e846c04a62925e3c09db89b7/act/runner/runner.go#L74 can be removed as well?
mfenniak approved these changes 2025-08-12 04:41:15 +00:00
mfenniak left a comment
Owner

Gusted's comment about ValidVolumes no longer being necessary on the Config object seems right at a glance; other than that this change makes sense to me.

I was curious, since I've never used it before, and I did a little test for whether the data race detector would identify this condition. It does... and there are a few other data races identified. After this fix, is there value in pursuing those, eliminating them, and maybe enabling data race detection during tests? I'd volunteer to try, as long as nobody would advise against it (eg. based upon their experience, if the data race detector isn't a valuable tool or the resource usage is too high to justify, etc.?).

eg.

go test -v -race ./act/runner/... --run TestRunner_RunEvent/evalmatrix 2>&1 | tee runner-tests-2.log
Gusted's comment about `ValidVolumes` no longer being necessary on the Config object seems right at a glance; other than that this change makes sense to me. I was curious, since I've never used it before, and I did a little test for whether the data race detector would identify this condition. It does... and there are a few other data races identified. After this fix, is there value in pursuing those, eliminating them, and maybe enabling data race detection during tests? I'd volunteer to try, as long as nobody would advise against it (eg. based upon their experience, if the data race detector isn't a valuable tool or the resource usage is too high to justify, etc.?). eg. ``` go test -v -race ./act/runner/... --run TestRunner_RunEvent/evalmatrix 2>&1 | tee runner-tests-2.log ```
viceice approved these changes 2025-08-12 05:07:33 +00:00
Author
Contributor

@mfenniak wrote in #849 (comment):

After this fix, is there value in pursuing those, eliminating them, and maybe enabling data race detection during tests? I'd volunteer to try, as long as nobody would advise against it (eg. based upon their experience, if the data race detector isn't a valuable tool or the resource usage is too high to justify, etc.?).

I have no experience using this tool and since it caught this one (which was painful to figure out), I'd say there is value in it. Maybe @Gusted did some work with that and has more experience.

@mfenniak wrote in https://code.forgejo.org/forgejo/runner/pulls/849#issuecomment-53455: > After this fix, is there value in pursuing those, eliminating them, and maybe enabling data race detection during tests? I'd volunteer to try, as long as nobody would advise against it (eg. based upon their experience, if the data race detector isn't a valuable tool or the resource usage is too high to justify, etc.?). I have no experience using this tool and since it caught this one (which was painful to figure out), I'd say there is value in it. Maybe @Gusted did some work with that and has more experience.
Author
Contributor

@mfenniak wrote in #849 (comment):

eg.

go test -v -race ./act/runner/... --run TestRunner_RunEvent/evalmatrix 2>&1 | tee runner-tests-2.log

I'm afraid to look... very cowardly of me.

@mfenniak wrote in https://code.forgejo.org/forgejo/runner/pulls/849#issuecomment-53455: > eg. > > ```text > go test -v -race ./act/runner/... --run TestRunner_RunEvent/evalmatrix 2>&1 | tee runner-tests-2.log > ``` I'm afraid to look... very cowardly of me.
Author
Contributor

@Gusted wrote in #849 (comment):

It seems
act/runner/runner.go
Line 74 in 555b322
ValidVolumes []string // only volumes (and bind mounts) in this slice can be mounted on the job container or service containers

can be removed as well?

It is set from the runner configuration value [container].valid_volumes

https://forgejo.org/docs/next/admin/actions/runner-installation/#configuration

ValidVolumes: r.cfg.Container.ValidVolumes,

@Gusted wrote in https://code.forgejo.org/forgejo/runner/pulls/849#issuecomment-53427: > It seems > [act/runner/runner.go](https://code.forgejo.org/forgejo/runner/src/commit/555b322ce5922942e846c04a62925e3c09db89b7/act/runner/runner.go#L74) > Line 74 in [555b322](https://code.forgejo.org/forgejo/runner/src/commit/555b322ce5922942e846c04a62925e3c09db89b7) > ` ValidVolumes []string // only volumes (and bind mounts) in this slice can be mounted on the job container or service containers ` > > can be removed as well? It is set from the runner configuration value `[container].valid_volumes` https://forgejo.org/docs/next/admin/actions/runner-installation/#configuration https://code.forgejo.org/forgejo/runner/src/commit/555b322ce5922942e846c04a62925e3c09db89b7/internal/app/run/runner.go#L331
earl-warren deleted branch wip-valid-volumes 2025-08-12 10:09:43 +00:00
Owner

@earl-warren wrote in #849 (comment):

I have no experience using this tool and since it caught this one (which was painful to figure out), I'd say there is value in it. Maybe @Gusted did some work with that and has more experience.

The race detector can be quite useful, but it's proportional to the amount of tests that make sure concurrent work is being done.

@earl-warren wrote in https://code.forgejo.org/forgejo/runner/pulls/849#issuecomment-53512: > I have no experience using this tool and since it caught this one (which was painful to figure out), I'd say there is value in it. Maybe @Gusted did some work with that and has more experience. The race detector can be quite useful, but it's proportional to the amount of tests that make sure concurrent work is being done.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
5 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo/runner!849
No description provided.