beads/internal/doltserver
matt wilkie 3b7eaa7d42
fix(doltserver): drain MySQL handshake before closing probe connections (#5277)
A bare Close() on a dial-only probe connection (waitForReady, the dolt-store
fail-fast dialer, the socket-fallback probe, the circuit breaker probe, and
several doctor/CLI reachability checks) sends a TCP RST instead of a clean
FIN. dolt sql-server interprets that RST as an aborted MySQL handshake;
enough of them in a short window can crash the server process (see #4132,
hamchowderr's Windows repro in issuecomment-5014617950 on #4132).

Add internal/doltserver.DrainAndCloseProbe/ProbeSQLServer, a shared helper
that reads (and discards) the handshake greeting before closing, and sweep
every MySQL-speaking dial+close probe in the tree onto it. waitForReady also
gets an F7 fix along the way: a dial that succeeds but never greets (TCP
listener accepting, MySQL engine not yet writing) is no longer treated as
ready — it keeps polling until a greeting arrives or the deadline passes.

Non-MySQL probes (remotesapi gRPC/HTTP, SSH, HTTP(S)) are left as bare
dial+close with a comment explaining why: there is no handshake to drain.

This lands the drain half of #4133 (Zireael). The config half (background
Dolt workers via --config YAML) is not ported here — it is superseded by
main's #4986 YAML-config path, which already addresses that PR's F1 lint
findings. The orphaned-server angle from #4133's report remains tracked by
the existing #4282.


Agent-Signature: claude-fable-5-high on behalf of maphew

Co-authored-by: Zireael <3856578+Zireael@users.noreply.github.com>
2026-08-10 12:51:12 -07:00
..
configport_test.go /{cmd,internal}: migration commands for server to proxied server 2026-07-13 13:23:47 -07:00
dirty_state_test.go test: add multi-process concurrency and server lifecycle integration tests 2026-03-22 15:01:45 -07:00
doltserver.go fix(doltserver): drain MySQL handshake before closing probe connections (#5277) 2026-08-10 12:51:12 -07:00
doltserver_test.go fix(doltserver): drain MySQL handshake before closing probe connections (#5277) 2026-08-10 12:51:12 -07:00
doltserver_unix.go perf: snapshot Dolt processes in one pass (bd-1rh.15) (#5326) 2026-08-03 20:49:27 -07:00
doltserver_unix_test.go perf: snapshot Dolt processes in one pass (bd-1rh.15) (#5326) 2026-08-03 20:49:27 -07:00
doltserver_windows.go fix(windows): detect exited processes in liveness helpers (#4980) (#4981) 2026-07-23 18:24:49 -07:00
doltserver_windows_test.go fix(windows): detect exited processes in liveness helpers (#4980) (#4981) 2026-07-23 18:24:49 -07:00
fdleak_integration_test.go fix(doltserver): stop detached children inheriting the caller's fds (#4634) (#5184) 2026-07-31 08:41:41 -07:00
gc_config.go Use Snappy output for Dolt garbage collection (#4986) 2026-07-23 08:55:29 -07:00
gc_config_test.go Use Snappy output for Dolt garbage collection (#4986) 2026-07-23 08:55:29 -07:00
lifecycle_integration_test.go Add PR CI wrapper command surface (#4211) 2026-05-29 18:52:53 -07:00
logrotate.go fix(doltserver): rotate dolt-server.log at startup to cap size (#3161) 2026-04-10 21:52:37 -07:00
logrotate_test.go fix(doltserver): rotate dolt-server.log at startup to cap size (#3161) 2026-04-10 21:52:37 -07:00
manifest_recovery.go fix(doltserver): gate corrupt-manifest .dolt reinit behind explicit bd doctor --fix (bd-6dnrw.6) 2026-06-11 00:30:13 -04:00
manifest_recovery_test.go fix(doltserver): gate corrupt-manifest .dolt reinit behind explicit bd doctor --fix (bd-6dnrw.6) 2026-06-11 00:30:13 -04:00
physical_root.go feat(workspacegate): shared physical-root resolver, beads.OpenGated, and CLI gate wiring (part 2) (#5093) 2026-07-31 01:41:20 -07:00
physical_root_test.go feat(workspacegate): shared physical-root resolver, beads.OpenGated, and CLI gate wiring (part 2) (#5093) 2026-07-31 01:41:20 -07:00
port_race_test.go test: add multi-process concurrency and server lifecycle integration tests 2026-03-22 15:01:45 -07:00
portsources_test.go fix(dolt): do not silently retarget an auto-started Dolt server onto a different port/database (#4052) (#5163) 2026-07-31 01:40:28 -07:00
probe.go fix(doltserver): drain MySQL handshake before closing probe connections (#5277) 2026-08-10 12:51:12 -07:00
probe_test.go fix(doltserver): drain MySQL handshake before closing probe connections (#5277) 2026-08-10 12:51:12 -07:00
procattr_linux.go fix(doltserver): reap leaked test dolt sql-servers (test-gated Pdeathsig + suite-exit sweep) (#4592) 2026-07-07 12:59:07 -07:00
procattr_linux_test.go fix(doltserver): reap leaked test dolt sql-servers (test-gated Pdeathsig + suite-exit sweep) (#4592) 2026-07-07 12:59:07 -07:00
procattr_other_unix.go fix(doltserver): reap leaked test dolt sql-servers (test-gated Pdeathsig + suite-exit sweep) (#4592) 2026-07-07 12:59:07 -07:00
servermode.go fix(config,dolt): infer server mode from a configured non-localhost host (GH#3545, GH#3518) (#5276) 2026-08-02 11:05:05 -07:00
socket_integration_test.go Add PR CI wrapper command surface (#4211) 2026-05-29 18:52:53 -07:00
sweep.go fix(doltserver): sweep Darwin test servers (wy-s4zdj) 2026-07-25 20:48:10 -07:00
sweep_darwin.go fix(doltserver): sweep Darwin test servers (wy-s4zdj) 2026-07-25 20:48:10 -07:00
sweep_linux.go fix(doltserver): reap leaked test dolt sql-servers (test-gated Pdeathsig + suite-exit sweep) (#4592) 2026-07-07 12:59:07 -07:00
sweep_other.go fix(doltserver): sweep Darwin test servers (wy-s4zdj) 2026-07-25 20:48:10 -07:00
sweep_test.go fix(doltserver): sweep Darwin test servers (wy-s4zdj) 2026-07-25 20:48:10 -07:00
testmain_integration_test.go fix(doltserver): reap leaked test dolt sql-servers (test-gated Pdeathsig + suite-exit sweep) (#4592) 2026-07-07 12:59:07 -07:00