Skip to content

Fix flaky Cloud socket test - #397

Open
cosmicspork wants to merge 1 commit into
laravel:0.xfrom
cosmicspork:fix/cloud-socket-test-hang
Open

cosmicspork wants to merge 1 commit into
laravel:0.xfrom
cosmicspork:fix/cloud-socket-test-hang

Conversation

@cosmicspork

Copy link
Copy Markdown

Hi, I hit a test flake at foundation::cloud::tests::lines_reach_the_socket_and_a_restarted_socket_receives_the_next_line in crates/core/src/foundation/cloud.rs. It failed or hung 5 of 18 runs of cargo test --all-features -p laravel-rust-core --lib. With --skip errors::panic it failed 0 of 30 times. Seeing this is a recurring issue, I thought it deserves a fix PR.

Run Branch Date Result
46660514031 pre-release-refinements (#380) 2026-12-01 Hang. "running for over 60 seconds" at 13:53, cancelled by the 6 hour job limit at 19:50
46730836252 bundle-framework-guides (#381) 2026-12-01 Assertion at cloud.rs:205
46371278853 harden-validation 2026-11-30 Assertion at cloud.rs:205
46354850798 mcp-conformance 2026-11-30 Assertion at cloud.rs:205

My diagnosis is that if the test drops its handle to the accepted connection while the child process spawned by errors::panic::tests::only_the_catching_thread_is_quiet_and_only_while_it_catches briefly holds the test's socket, the dropped handle doesn't close the connection as expected. Holding a try_clone() of the accepted socket makes the test hang every time.

This PR is a test-only change, the framework isn't affected because the real socket's server end lives in another process. I'm proposing a fix using shutdown(Shutdown::Both) to close the socket itself, so the child process copy no longer matters. This now passes 30 of 30 times, and with try_clone().

I used Claude to assist with the investigation and fix.

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.

1 participant