Skip to content

sqlc-test-setup: run Spanner Omni on kernels without IPv6 - #4641

Open
kyleconroy wants to merge 1 commit into
mainfrom
claude/spanner-omni-no-ipv6-01L8QoGi6VRtADkb4jL3BFHP
Open

kyleconroy wants to merge 1 commit into
mainfrom
claude/spanner-omni-no-ipv6-01L8QoGi6VRtADkb4jL3BFHP

Conversation

@kyleconroy

Copy link
Copy Markdown
Collaborator

Spanner Omni's services open IPv6 sockets at startup and abort when the kernel was built without IPv6 (Failed to create socket with ::socket ... Address family not supported by protocol in base_services), which is the case in Claude Code's remote environments. Omni has no flag to avoid it, and spanner start-single-server passes no flags through anyway.

sqlc-test-setup start spanner now checks whether opening an AF_INET6 socket fails with EAFNOSUPPORT. Only then does it build v6to4, a small LD_PRELOAD library, with cc and preload it into Omni. The library creates IPv6 sockets as IPv4 ones and translates addresses both ways (::, ::1, ::ffff:a.b.c.d), so Omni still sees IPv6. On kernels with IPv6, including the GitHub runners, Omni starts exactly as before.

  • cmd/sqlc-test-setup/v6to4/v6to4.c: the library. It calls the kernel through syscall() and is built without fortify or the stack protector, so it needs nothing newer than the glibc 2.27 Omni ships with. It lives in its own folder because a .c file in a Go package without cgo breaks go build.
  • cmd/sqlc-test-setup/omni_ipv6.go: embeds the source and builds Omni's environment.
  • cmd/sqlc-test-setup/ipv6_linux.go, ipv6_other.go: the kernel check, and a stub that returns false off Linux, where Omni isn't published.
  • cmd/sqlc-test-setup/main.go: startSpannerOmni starts Omni with that environment.

Testing

In a container without IPv6:

  • go run ./cmd/sqlc-test-setup start spanner built the library, preloaded it and reached a serving Omni; a second run was a no-op.
  • SPANNER_SERVER_URI=localhost:15000 go test --tags=examples ./authors/googlesql/ under examples/ passes.
  • go vet ./cmd/sqlc-test-setup is clean for linux and darwin, and the command builds for windows.

The path for kernels that do have IPv6 is a single early return and was not exercised here, since this container lacks IPv6.

🤖 Generated with Claude Code

https://claude.ai/code/session_01L8QoGi6VRtADkb4jL3BFHP


Generated by Claude Code

Spanner Omni's services open IPv6 sockets at startup and abort when the
kernel has no IPv6, as in Claude Code's remote environments. When opening
an AF_INET6 socket fails with EAFNOSUPPORT, start now builds v6to4, a small
LD_PRELOAD library that runs those sockets over IPv4, and preloads it into
Omni. Kernels with IPv6 start Omni as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01L8QoGi6VRtADkb4jL3BFHP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants