beads/internal/doltserver
Bee d4309098e5
fix(doltserver): prove listener ownership on darwin with lsof and ps (#7232) (#7257)
On macOS listenerOwnership always answered known=false, so once a foreign
process greeted on the port chosen for a new dolt sql-server, Start adopted
that listener as its own (the default log level emits no ready line to
disprove it). TestStart_RecoversWhenEphemeralPortIsTaken has failed on the
Main workflow's macOS job on every push since #7201 (14/14 completed runs);
PR CI has no macOS test job, so no PR saw it.

Darwin has no /proc, so the listener's processes come from lsof and the
process tree from ps, the two tools this package already uses to find a
port's holder and a server's working directory. Each pid lsof lists on the
port is walked up its parent chain; reaching the child proves the listener
is the child's (or a descendant's, for a wrapper that does not exec). Both
reads run only once a greeting has arrived, never on the bare poll.

known is false when either tool fails or lists no listener at all, and
Start then falls back to the greeting as before. A child that no longer
exists is known not to own anything, as on Linux.

The tests that were Linux-only because ownership was only provable there now
run on darwin too, and the darwin file gets its own fake-read table, parser
tests, and a real-tool test with an in-process listener and a listener in a
grandchild process. On this machine the formerly red test passes 10/10
(it failed 40/40 on main).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-06 23:24:18 +00:00
..
BUILD.bazel fix(doltserver): prove listener ownership on darwin with lsof and ps (#7232) (#7257) 2026-10-06 23:24:18 +00: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): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
doltserver_test.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
doltserver_unix.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -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(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
doltserver_windows_test.go fix(windows): detect exited processes in liveness helpers (#4980) (#4981) 2026-07-23 18:24:49 -07:00
fakedolt_test.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -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 feat(doltserver): add fenced restart and remotesapi listener support (#6020) 2026-10-01 00:57:54 -07:00
listenerowner_darwin.go fix(doltserver): prove listener ownership on darwin with lsof and ps (#7232) (#7257) 2026-10-06 23:24:18 +00:00
listenerowner_darwin_test.go fix(doltserver): prove listener ownership on darwin with lsof and ps (#7232) (#7257) 2026-10-06 23:24:18 +00:00
listenerowner_linux.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
listenerowner_linux_test.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
listenerowner_other.go fix(doltserver): prove listener ownership on darwin with lsof and ps (#7232) (#7257) 2026-10-06 23:24:18 +00: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
managed_server_proof_test.go fix(storage): an env-pointed server is shared, not owned — close the migrate-gate bypass (#6118) 2026-09-04 23:37:32 -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(backends): registry Remote + OpenWith options; beads.OpenBestAvailableWith for embedders (#7188) 2026-10-04 09:34:36 -07:00
physical_root_test.go feat(backends): registry Remote + OpenWith options; beads.OpenBestAvailableWith for embedders (#7188) 2026-10-04 09:34:36 -07:00
port_race_test.go test: add multi-process concurrency and server lifecycle integration tests 2026-03-22 15:01:45 -07:00
portsource_invariant_test.go fix(dolt): explicit ServerPort must outrank ambient BEADS_DOLT_SERVER_PORT env var (#5835) 2026-08-20 05:43:57 -07:00
portsources_test.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -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): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -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 feat(doltserver): add fenced restart and remotesapi listener support (#6020) 2026-10-01 00:57:54 -07:00
socket_integration_test.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
startowned.go fix(doltserver): prove listener ownership on darwin with lsof and ps (#7232) (#7257) 2026-10-06 23:24:18 +00:00
startowned_test.go fix(doltserver): prove listener ownership on darwin with lsof and ps (#7232) (#7257) 2026-10-06 23:24:18 +00:00
startupwatch.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
startupwatch_test.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
sweep.go fix(doltserver): recognize /var/tmp as a fixed temp root on Linux for sandbox-home detection (#6729) 2026-09-26 08:33:28 -07:00
sweep_darwin.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_darwin_test.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_linux.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_other.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_reap_unix.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_reap_unix_test.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_suite.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_suite_linux_test.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_suite_other.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_suite_test.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_suite_unix.go fix(test): reap dolt sql-servers leaked by killed test runs, and fail the suite that leaks (#6441) 2026-09-22 15:08:40 -07:00
sweep_test.go fix(doltserver): recognize /var/tmp as a fixed temp root on Linux for sandbox-home detection (#6729) 2026-09-26 08:33:28 -07:00
testmain_integration_test.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00
testmain_test.go fix(doltserver): auto-started dolt must own its port; move a taken bd-chosen port (#7201) 2026-10-04 09:22:03 -07:00