Skip to content

Fix concurrent map access in LogMonitor causing flaky test crashes#1872

Closed
prafgup wants to merge 1 commit into
awslabs:mainfrom
prafgup:fix-integration-map-concurrent-test
Closed

Fix concurrent map access in LogMonitor causing flaky test crashes#1872
prafgup wants to merge 1 commit into
awslabs:mainfrom
prafgup:fix-integration-map-concurrent-test

Conversation

@prafgup
Copy link
Copy Markdown
Contributor

@prafgup prafgup commented Feb 23, 2026

Issue #, if available:

Failure - https://github.com/awslabs/soci-snapshotter/actions/runs/22316452115/job/64568052875

=== RUN   TestLazyPullNoIndexDigest
=== RUN   TestLazyPullNoIndexDigest/normal
fatal error: concurrent map iteration and map write

goroutine 5519 [running]:
internal/runtime/maps.fatal({0xe03530?, 0xad?})
	/codebuild/output/src2529771585/src/actions-runner/_work/_tool/go/1.25.7/arm64/src/runtime/panic.go:1046 +0x20
internal/runtime/maps.(*Iter).Next(0x40000500b0?)
	/codebuild/output/src2529771585/src/actions-runner/_work/_tool/go/1.25.7/arm64/src/internal/runtime/maps/table.go:792 +0x98
github.com/awslabs/soci-snapshotter/util/testutil.(*LogMonitor).scanLog(0x400007e230, {0xf22720?, 0x40009b02c0?})
	/codebuild/output/src2529771585/src/actions-runner/_work/soci-snapshotter/soci-snapshotter/util/testutil/shell.go:146 +0xe0
created by github.com/awslabs/soci-snapshotter/util/testutil.NewLogMonitor in goroutine 5525
	/codebuild/output/src2529771585/src/actions-runner/_work/soci-snapshotter/soci-snapshotter/util/testutil/shell.go:119 +0x1dc

Description of changes:

  • LogMonitor.monitorFuncs was a plain map[string]func(string) accessed concurrently by scanLog goroutines and test code calling Add/Remove, causing fatal error: concurrent map iteration and map write.
  • Replaced with sync.Map

Testing performed:

Ran integration tests -

  • TestLazyPullNoIndexDigest

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Signed-off-by: Praful Gupta <prafulgupta6@gmail.com>
@prafgup prafgup requested a review from a team as a code owner February 23, 2026 20:40
@github-actions github-actions Bot added the go Pull requests that update Go code label Feb 23, 2026
@sondavidb
Copy link
Copy Markdown
Contributor

#1778 should also fix this FWIW.

@sondavidb
Copy link
Copy Markdown
Contributor

#1778 is merged so I think this is not needed anymore. Feel free to reopen if you feel otherwise 🙂

@sondavidb sondavidb closed this Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants