Bug: Fix Logx Concurrent Map Mutation in Context Field Propagation - #2066
Merged
Conversation
golanglemonade
approved these changes
Feb 25, 2026
adelowo
approved these changes
Feb 25, 2026
adelowo
enabled auto-merge (squash)
February 25, 2026 16:09
|
Achiket123
pushed a commit
to Achiket123/core
that referenced
this pull request
Feb 28, 2026
…heopenlane#2066) * fix ts bug and logx wrapper * add a unit test
golanglemonade
added a commit
that referenced
this pull request
Mar 17, 2026
* Specs for exporting * fix(deps): update all patch dependencies (#2037) * fix(deps): update all patch dependencies * fix entity status Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> --------- Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * Directory + Integration + Identity Holder Schema Relationships + Refs (#2061) * uplift directory account schemas, fga, integration refs * generate output * Bug: Fix Logx Concurrent Map Mutation in Context Field Propagation (#2066) * fix ts bug and logx wrapper * add a unit test * fix(deps): update all patch dependencies (#2064) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update module github.com/alicebob/miniredis/v2 to v2.37.0 (#2065) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * debug: adding logs for cf trigger cache (#2067) Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * Fix EventQueue `ClientFromHandler` to Inject ent client | Enrich River Job submission with Listener Info (#2070) * fix client injection / context return with ent client and add metadata and tags to river * add listener name and some other metadata * Notification from standards updates (#2072) * control diffing after a standard revision is bumped * extend tests * task regenerate * use ctx * Bulk evidence export (#2074) * task regenerate * add mode and metadata to export job spec * fix merge conflicts * update task cli:generate:enum template * use enqueue * fix(deps): update all patch dependencies (#2068) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * chore(deps): update anchore/sbom-action action to v0.23.0 (#2071) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Shuffle Integration Record Creation | Confirm Credentials Pre-store (#2075) * add normalization to prevent failures (#2078) * OSCAL Support Mapping + entx plugin (#2077) * schema updates / additions, prep for generation * rename to something that's going to play nice with pluralization * with policy and annotations * add the schema migrations and output of new plugin and annotations, fields * remove bad mixin ref * Update internal/ent/schema/systemdetail.go Co-authored-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> Signed-off-by: Matt Anderson <42154938+matoszz@users.noreply.github.com> --------- Signed-off-by: Matt Anderson <42154938+matoszz@users.noreply.github.com> Co-authored-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * fix: allow comments to be added / removed by member users (#2079) * fix: allow comments to be added / removed by member users Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * regen Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * fix: slate parse, test Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * fix test Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * remove logs from testing Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> --------- Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> * add identity holder crud tests (#2082) * export db migration (#2083) * fix(deps): update all patch dependencies (#2076) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update module github.com/cloudflare/cloudflare-go/v6 to v6.8.0 (#2081) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * fix(deps): update module github.com/aws/aws-sdk-go-v2/service/securityhub to v1.68.0 (#2073) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * best swing at mapx as ill get (#2084) * Specs for exporting * Some More Fixes * Remove duplicate ExportExportMode enum from schema.graphql Removed duplicate ExportExportMode enum definition from schema. Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> * Delete duplicare ExportExportMode enum from ent.graphql Removed duplicare ExportExportMode enum definition from schema. Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> * fix:generate errors * Update internal/objects/validators/mime.go Co-authored-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> * Update exportFiles MIME types to include application/zip Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> * Add PDF and Markdown types to exportFiles Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> * Refactor validMimeTypes for formatting Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> * Add 'application/zip' to exportFiles MIME types Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> --------- Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> Signed-off-by: Matt Anderson <42154938+matoszz@users.noreply.github.com> Signed-off-by: Achiket Kumar <126181868+Achiket123@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com> Co-authored-by: Matt Anderson <42154938+matoszz@users.noreply.github.com> Co-authored-by: Lanre Adelowo <yo@lanre.wtf>
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.



Addresses a production panic
(fatal error: concurrent map iteration and map write)surfaced by Trust Center event listener activity.Root cause: logx.WithField and logx.WithFields mutated the LogFields map in-place rather than allocating a new copy. Every context derived from the same request shared the same underlying map.
The race: after a transaction commits, emit() closures fire per mutation and submit work to the in-memory gala pool. The committing goroutine calls DurableContextCodec.Capture → json.Marshal on a snapshot holding a direct reference to the shared LogFields map (iterating it). Concurrently, pool workers processing previously dispatched envelopes call DurableContextCodec.Restore → logx.WithFields → writing to that same map.
Fix: WithField and WithFields now allocate a new map on each call. DurableContextCodec.Capture additionally clones the fields map before marshaling as a defensive measure.