Fix: Handle EBADF in synserver accept instead of aborting#12930
Open
bryancall wants to merge 2 commits intoapache:masterfrom
Open
Fix: Handle EBADF in synserver accept instead of aborting#12930bryancall wants to merge 2 commits intoapache:masterfrom
bryancall wants to merge 2 commits intoapache:masterfrom
Conversation
When the listening socket is closed by synserver_stop while the accept is still pending, net_accept sends EVENT_ERROR with -EBADF. Instead of calling ink_abort (which crashes the regression suite), log a warning and return gracefully. Other unexpected events still abort. This race occurs because multiple EXCLUSIVE_REGRESSION_TEST tests share port 3300 and their teardown can overlap with a pending accept.
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the synserver accept continuations used by the API regression tests to treat EBADF during teardown as an expected race (listener closed while an accept is pending), preventing intermittent test-suite aborts.
Changes:
- Handle
TS_EVENT_ERRORwithdata == -EBADFinsynserver_vc_accept()andsynserver_vc_refuse()by returning instead of aborting. - Preserve existing abort behavior (with diagnostics) for all other unexpected events / errno payloads.
Switch EBADF handling from Warning() to Dbg(dbg_ctl_SockServer, ...) since this is an expected teardown race and Warning is too noisy. Restore the comment explaining the -4095 Linux MAX_ERRNO guard.
ezelkow1
approved these changes
Feb 28, 2026
Contributor
Author
|
[approve ci autest 0] |
Contributor
Author
|
[approve ci clang-analyzer] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The regression suite intermittently crashes in
synserver_vc_acceptwith:This happens because multiple
EXCLUSIVE_REGRESSION_TESTtests (SDK_API_HttpTxnTransform,SDK_API_HttpAltInfo, etc.) share port 3300 and their teardown can overlap with a pending accept. Whensynserver_stop/synserver_deletecloses the listening socket,net_accept()getsEBADFfromaccept()and sendsEVENT_ERRORwith-EBADFas data to the continuation.Related PRs
TSAssertwithink_abortthat prints the event type and errno. The output from that change confirmed the root cause:EVENT_ERROR(3) withEBADF(9) during test teardown.Changes
EVENT_ERROR+EBADFgracefully -- in bothsynserver_vc_acceptandsynserver_vc_refuse, check specifically forEVENT_ERRORwithdata == -EBADFand return instead of aborting. This is the expected error when the listening socket was closed during teardown.ink_abortwith full diagnostics, so new failure modes won't be silently swallowed.Testing