Repository navigation
Conversation
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Comment |
kavix
force-pushed
the
fix/serialize-module-activation
branch
from
September 23, 2026 16:14
f65e8e4 to
5e5f78a
Compare
Contributor
|
The concurrent-install test passes and the namespace lock addresses the main race. Before merging, could you please:
|
Contributor
Author
|
Thanks for the review @kanushka! I have updated the branch with the requested changes |
kanushka
reviewed
Oct 9, 2026
Serialize activation per product namespace with an advisory file lock in the state root, preventing concurrent shell processes from interleaving staging, moving aside versions, restoring .replaced, or writing policy and active state. - Add Store.LockPath(namespace) placing the lock file beside the namespace directory - Wrap Installer.activate() in lockfile.With() - Add concurrent install test and failure-injection rollback test - Add end-to-end acceptance test for concurrent installs Fixes wso2#240 Signed-off-by: kavix <kavix@yahoo.com>
… layout - Run gofmt on new test files - Add <namespace>.lock to storage layout in docs/architecture.md - Strengthen failure-injection test to verify rollback from .replaced on same-version reinstall failure Signed-off-by: kavix <kavix@yahoo.com>
Signed-off-by: kavix <kavix@yahoo.com>
kavix
force-pushed
the
fix/serialize-module-activation
branch
from
October 10, 2026 08:50
4e37f37 to
a8737a5
Compare
Contributor
Author
|
Thanks @kanushka! Updated |
kanushka
requested changes
Oct 12, 2026
kanushka
left a comment
Contributor
There was a problem hiding this comment.
Thanks, the lock is in the right place and all earlier comments are addressed. Two things before merging:
- The concurrency tests don't catch the race. With the install.go from
mainand the tests from this PR,TestConcurrentInstallsActivateCleanlyMatchingExactlyOneInstallpasses 300/300 andTestConcurrentInstallsMatchExactlyOneInstallpasses 20/20. Both install different versions (1.0.0 and 1.1.0), so they never share.replaced. Could you make them run concurrent installs of the same version, or add a test hook that pauses activation between staging and the policy write, and confirm they fail without the lock? - The busy-lock error is wrong (
internal/install/install.go:353-358). When the lock is held,lockfile.ErrBusygoes throughstoreFailure. The user is told "locking the module namespace failed: lockfile: …" and is asked to check the state-directory permissions. Please map busy the same wayinternal/contexts/save.go:169does: another invocation is updating the product, retry the command. Please keep thelockfile:package name out of the message as well, and add a test for the busy path.
Non-blocking, fine as follow-ups:
Store.Remove(wso2 product remove) doesn't take the namespace lock, so a remove that runs during an install can leave a half-removed namespace.updateOnereads the channel and pin before taking the lock, so a pin that lands in between can be overwritten.- Per ADR 0007,
declarationTimeoutshould point back tolockDeadline, since the two values are coupled.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two shell processes can stage, move aside the same version, restore the shared
.replaceddirectory, and write policy and active state independently. The final state can mix decisions from different installs (#240).Solution
Serialize module activation per product namespace using the shell's advisory file lock (
internal/lockfile) in the state root:Store.LockPath(namespace)ininternal/modules/store.goto return the namespace lock path (<store>/<namespace>.lock). Per ADR 0007, the lock sits beside the namespace directory so rollback cleanup of a failed first install never unlinks the lock file.Installer.activate()ininternal/install/install.goinsidelockfile.With(), bounding wait time under15 * time.Second(abovedeclarationTimeoutof 10s plus margin to accommodate running the installed executable).storeFailure.<namespace>.lockto the storage layout indocs/architecture.md.Acceptance
TestConcurrentInstallsActivateCleanlyMatchingExactlyOneInstallininternal/install/install_test.goandTestConcurrentInstallsMatchExactlyOneInstallintest/acceptance/moduleinstall_test.go.TestInterruptedInstallLeavesPreviousVersionActiveininternal/install/install_test.goexercising same-version reinstall rollback from.replaced.Closes #240