Skip to content

Conversation

@shlomi-noach
Copy link
Contributor

Description

#18196 seemed to have introduces a recurring CI failure in onlineddl_vrepl_suite where vttablet panics as follows:

fatal error: concurrent map read and map write

goroutine 364949 gp=0x1400034dc00 m=17 mp=0x140008d4808 [running]:
runtime.fatal({0x1021f9923, 0x21})
	runtime/panic.go:1116 +0x48 fp=0x1400481adc0 sp=0x1400481ad90 pc=0x1000e5c58
internal/runtime/maps.fatal({0x1021f9923?, 0x1000ad1d0?})
	runtime/panic.go:1046 +0x20 fp=0x1400481ade0 sp=0x1400481adc0 pc=0x10011eb50
runtime.mapaccess2(0x1031abf00, 0x14000d81770, 0x1400481ae78)
	internal/runtime/maps/runtime_swiss.go:136 +0x48 fp=0x1400481ae50 sp=0x1400481ade0 pc=0x1000b04b8
vitess.io/vitess/go/mysql/replication.Mysql56GTIDSet.Contains(0x14000d81770, {0x1032e6b40?, 0x14002e9e750?})
	vitess.io/vitess/go/mysql/replication/mysql56_gtid_set.go:248 +0xc8 fp=0x1400481af00 sp=0x1400481ae50 pc=0x100bfd1f8
vitess.io/vitess/go/mysql/replication.Position.AtLeast(...)
	vitess.io/vitess/go/mysql/replication/replication_position.go:83
vitess.io/vitess/go/vt/vttablet/tabletserver/schema.(*Engine).ReloadAtEx(0x140006b3e10, {0x1032c7df8, 0x1053a98e0}, {{}, {0x1032e6b40?, 0x14002e9e750?}}, 0x0)
	vitess.io/vitess/go/vt/vttablet/tabletserver/schema/engine.go:405 +0x148 fp=0x1400481af90 sp=0x1400481af00 pc=0x1012d6ec8
vitess.io/vitess/go/vt/vttablet/tabletserver/schema.(*Engine).ReloadAt(...)
	vitess.io/vitess/go/vt/vttablet/tabletserver/schema/engine.go:389
vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer.(*vstreamer).parseEvent(0x14001dd8360, {0x1032fb590, 0x140020783a0}, 0x14004fa3630)
	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go:572 +0xbcc fp=0x1400481b330 sp=0x1400481af90 pc=0x1014b2f3c
vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer.(*vstreamer).parseEvents(0x14001dd8360, {0x1032c7f70, 0x140018759a0}, 0x14002088e00, 0x14002088e70)
	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go:389 +0x5a8 fp=0x1400481b660 sp=0x1400481b330 pc=0x1014b1168
vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer.(*vstreamer).replicate(0x14001dd8360, {0x33?, 0x140018726d0?})
	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go:214 +0xdc fp=0x1400481b6e0 sp=0x1400481b660 pc=0x1014b0aac
vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer.(*vstreamer).Stream(0x14001dd8360)
	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/vstreamer.go:193 +0x160 fp=0x1400481b780 sp=0x1400481b6e0 pc=0x1014b0840
vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer.(*uvstreamer).Stream(0x1400013ec80)
	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/uvstreamer.go:460 +0x240 fp=0x1400481b850 sp=0x1400481b780 pc=0x1014af2f0
vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer.(*Engine).Stream(0x14000548580, {0x1032c7f38, 0x14002455170}, {0x14002d0b000, 0x33}, {0x0, 0x0, 0x0}, 0x14001c13560, {0x1021a330d, ...}, ...)
	vitess.io/vitess/go/vt/vttablet/tabletserver/vstreamer/engine.go:280 +0x114 fp=0x1400481b910 sp=0x1400481b850 pc=0x10149d8c4
vitess.io/vitess/go/vt/vttablet/tabletserver.(*TabletServer).VStream(0x14000044870, {0x1032c7f38, 0x14002455170}, 0x14001b28300, 0x14002b13638)
	vitess.io/vitess/go/vt/vttablet/tabletserver/tabletserver.go:1285 +0x80 fp=0x1400481b990 sp=0x1400481b910 pc=0x10155f450
vitess.io/vitess/go/vt/vttablet/grpcqueryservice.(*query).VStream(0x14000d05ba0, 0x14001b28300, {0x1032debf0, 0x14001504f60})
	vitess.io/vitess/go/vt/vttablet/grpcqueryservice/server.go:348 +0x100 fp=0x1400481ba30 sp=0x1400481b990 pc=0x101d49620

This is the reading code. The writing code must be AppendGTIDInPlace().
I'm not entire sure yet how come there's concurrency specifically in ReloadEx, since parseEvent runs Reload() and AppendGTIDInPlace() sequentially. In this PR I will try to resolve the matter.

Related Issue(s)

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

@vitess-bot
Copy link
Contributor

vitess-bot bot commented Aug 31, 2025

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

@vitess-bot vitess-bot bot added NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says labels Aug 31, 2025
@github-actions github-actions bot added this to the v23.0.0 milestone Aug 31, 2025
@codecov
Copy link

codecov bot commented Aug 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 67.52%. Comparing base (39d6c69) to head (24e2a2e).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18610   +/-   ##
=======================================
  Coverage   67.51%   67.52%           
=======================================
  Files        1607     1607           
  Lines      263328   263328           
=======================================
+ Hits       177796   177822   +26     
+ Misses      85532    85506   -26     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Shlomi Noach <[email protected]>
@shlomi-noach shlomi-noach deleted the protect-append-in-place branch August 31, 2025 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

NeedsBackportReason If backport labels have been applied to a PR, a justification is required NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsWebsiteDocsUpdate What it says

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant