Skip to content

fix(embed): shorten test unix socket paths - #33111

Merged
XuPeng-SH merged 3 commits into
4.2-devfrom
fix/embed-unix-socket-temp-42
Nov 24, 2026
Merged

XuPeng-SH merged 3 commits into
4.2-devfrom
fix/embed-unix-socket-temp-42

Conversation

@XuPeng-SH

Copy link
Copy Markdown
Contributor

Summary

  • Use short, UUID-based Unix socket paths for embedded test CNs.
  • Preserve the existing DataDir/mysql<I>.sock layout for non-testing clusters.
  • Cover stale socket isolation, path stability and length, and a real Unix socket connection.

Root cause

t.TempDir() inherits GOTMPDIR. A long temporary directory makes the generated <data-dir>/mysql0.sock exceed the Unix socket path limit, causing frontend startup to panic with bind: invalid argument. This is shared embedded-test infrastructure behavior, not a regression specific to #33094.

Related: #33094

Validation

  • Reproduced the failure on base b757475d7582c14e85defa0c2c00ad119dce444a with a 141-character GOTMPDIR.
  • The same TestMarkScanGuardSQL regression passes after the fix.
  • Focused socket path and stale-file tests: PASS.
  • Full pkg/embed package: PASS (199.395s), including multi-CN and StartNewCNService tests.
  • go vet ./pkg/embed: PASS.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: e730e3ddbb5b5acd3d94fe4cb7bfa44ea2f10fdf

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: e730e3ddbb5b5acd3d94fe4cb7bfa44ea2f10fdf

Assessment: request_changes

The short socket path fixes embedded test startup under a long GOTMPDIR. The non-testing branch also changes path resolution for valid data directories that traverse a symlink before .., moving the socket away from the existing endpoint.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

  • P3 pkg/embed/cluster.go:514: Start a non-testing cluster with WithDataPath("/tmp/example/link/../data") where link points to actual/child.
    Impact: filepath.Join removes link/.. before the filesystem resolves the symlink. The socket moves from actual/data/mysql0.sock to data/mysql0.sock, so clients using the existing endpoint cannot connect.
    Evidence: The baseline template appends /mysql0.sock to the supplied path verbatim. The retained probe bound both rendered paths on Linux and verified they land in different directories. See path-semantics.jsonl and checks/1795457413140665539-2.json. Preserve literal path concatenation for non-testing clusters and keep the short UUID path for test mode.

Validation:

  • Private /tmp and loopback preflight passed. Verified the clean checkout, frozen patch, native input ledger and six library hashes. See verification.log and checks/1795457625760107768-2.json.

  • Both new socket tests, the dynamic CN startup test and TestMarkScanGuardSQL passed on the assigned head. See embed-focused.jsonl and checks/1795457547492499300-2.json.

  • The unchanged TestMarkScanGuardSQL failed at Unix socket bind with bind: invalid argument when both changed implementation files were overlaid with their exact base versions. See embed-baseline.jsonl and checks/1795457576115879999-2.json.

Limitations:

  • Local execution covered focused Linux tests. The full embed suite, race mode and macOS runtime were not independently verified.

  • The frozen evidence identified #33094 as related and omitted its PR discussion.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

mo-bot review · mo-bot-local · done

Commit: 5dc975403f32277d64ba6815706466a1bdae0924

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 5dc975403f32277d64ba6815706466a1bdae0924

Assessment: approve

Embedded test CNs now use short, cluster-unique Unix socket paths. Non-testing clusters preserve the configured endpoint through symlink traversal, resolving the previous review finding.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • Private /tmp and loopback preflight passed. The checkout matched the assigned head, and all six retained native library checksums matched. See receipts 1795461184219314511-2 and 1795461184822152807-2.

  • The pkg/embed suite passed on Linux, including dynamic CN startup and the three socket regression tests. A review probe also verified that the rendered non-testing configuration bound in the symlink-resolved directory and that closing the listener removed the socket. See embed-package.jsonl and receipt 1795461716716008438-2.

  • TestMarkScanGuardSQL passed with a 114-byte data directory. The same test with the two pinned base implementation files overlaid failed at bind on the old 125-byte socket path. See long-path-sql.jsonl and long-path-base.jsonl with receipts 1795461464159462025-2 and 1795461548580826345-2.

Limitations:

  • Local runtime checks covered Linux. The existing TestRestartCN was skipped by the suite.

  • The frozen evidence identifies #33094 as a related PR. Its discussion was outside the supplied evidence.

This branch was previously deployed

1 inactive deployment
ci — 5dc97540 Deployed Nov 23, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes [10,99] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants