Skip to content

Stabilize test server boot on macOS#261

Merged
felipedmesquita merged 1 commit intotyphoeus:masterfrom
tagliala:chore/260-allow-specs-to-run-on-mac
Aug 25, 2025
Merged

Stabilize test server boot on macOS#261
felipedmesquita merged 1 commit intotyphoeus:masterfrom
tagliala:chore/260-allow-specs-to-run-on-mac

Conversation

@tagliala
Copy link
Copy Markdown
Contributor

Ensure the spec helper's WEBrick server starts and is detected reliably on recent macOS:

  • Bind WEBrick explicitly to localhost and probe readiness via 127.0.0.1 to avoid IPv6/IPv4 localhost resolution mismatches that triggered Net::OpenTimeout during boot. (Copilot)
  • Use a single Rackup/Rack WEBrick handler constant consistently
  • Keep WEBrick for tests since it supports custom methods (e.g. PURGE) that stricter servers reject.
  • Trap INT and call handler.shutdown via the shared constant to cleanly stop the server process, helping prevent orphaned servers and file descriptor leaks (seen as Errno::EMFILE after reruns).
  • Replace deprecated top-level TimeoutError with Timeout::Error and require timeout

With these changes, the test server comes up promptly and the suite no longer times out on Apple Silicon/macOS, and repeated runs don't exhaust file descriptors.

Fix #260

Ensure the spec helper's WEBrick server starts and is detected
reliably on recent macOS:
- Bind WEBrick explicitly to `localhost` and probe readiness via
  `127.0.0.1` to avoid IPv6/IPv4 `localhost` resolution mismatches that
  triggered Net::OpenTimeout during boot. (Copilot)
- Use a single Rackup/Rack WEBrick handler constant consistently
- Keep WEBrick for tests since it supports custom methods (e.g. `PURGE`)
  that stricter servers reject.
- Trap INT and call handler.shutdown via the shared constant to cleanly
  stop the server process, helping prevent orphaned servers and file
  descriptor leaks (seen as `Errno::EMFILE` after reruns).
- Replace deprecated top-level `TimeoutError` with `Timeout::Error` and
  require `timeout`

With these changes, the test server comes up promptly and the suite no
longer times out on Apple Silicon/macOS, and repeated runs don't exhaust
file descriptors.

Fix typhoeus#260
@tagliala
Copy link
Copy Markdown
Contributor Author

tagliala commented Aug 24, 2025

This is co-authored by Copilot, actually it did find the issue with IPv4 IPv6 which was preventing the server to work on macos

Failures are unrelated (segfault)

@felipedmesquita
Copy link
Copy Markdown
Member

Thanks, @tagliala!
On my Ventura Intel Mac, the test still fail in this branch. It also seems we've accidentally found the first consistent CI segfault here with ruby 2.6, as I've ran the test 7 times without success.
I don't have an apple silicon mac to test this today, but since this fixes the failures for you, I'm merging it in. It's better to have the tests working for newer macs than have 2.6 passing in CI for now.

@felipedmesquita felipedmesquita merged commit b5f755d into typhoeus:master Aug 25, 2025
150 of 160 checks passed
@tagliala tagliala deleted the chore/260-allow-specs-to-run-on-mac branch August 25, 2025 12:05
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.

Test server may have some issues on Apple Silicon / macOS

2 participants