You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "bryancall (via GitHub)" <gi...@apache.org> on 2026/02/20 07:51:30 UTC
[PR] Fix: synserver accept assertion to log event details before aborting [trafficserver]
bryancall opened a new pull request, #12903:
URL: https://github.com/apache/trafficserver/pull/12903
Replace bare `TSAssert` in `synserver_vc_accept` and `synserver_vc_refuse` with a diagnostic `ink_abort` that logs the unexpected event number and, if the data looks like a negated errno, the `strerror` string.
Rocky CI build [#8376](https://ci.trafficserver.apache.org/job/Github_Builds/job/rocky/8376/) crashed with a core dump in `synserver_vc_accept` after `SDK_API_HttpParentProxySet_Success` passed:
```
[SDK_API_HttpParentProxySet_Success] TSHttpTxnParentProxySet : [TestCase] <<PASS>> { Received expected response ID 11 }
Fatal: ../src/api/InkAPITest.cc:916: failed assertion $(echo '(event == TS_EVENT_NET_ACCEPT) || (event == TS_EVENT_NET_ACCEPT_FAILED)')
```
The `TSAssert` gave no information about which event was received. The `net_accept()` code in `UnixNetAccept.cc` can send `EVENT_ERROR` with a negated errno when `accept()` fails, but without diagnostics we cannot confirm that. This change ensures the next failure logs the actual event number and errno so we can make a targeted fix.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] synserver accept assertion to log event details before aborting [trafficserver]
Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #12903:
URL: https://github.com/apache/trafficserver/pull/12903#issuecomment-4121419949
Cherry-picked to 10.2.x
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] synserver accept assertion to log event details before aborting [trafficserver]
Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on PR #12903:
URL: https://github.com/apache/trafficserver/pull/12903#issuecomment-3937743322
[approve ci autest 1]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] synserver accept assertion to log event details before aborting [trafficserver]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #12903:
URL: https://github.com/apache/trafficserver/pull/12903#discussion_r2831891904
##########
src/api/InkAPITest.cc:
##########
@@ -892,7 +892,14 @@ synserver_delete(SocketServer *s)
static int
synserver_vc_refuse(TSCont contp, TSEvent event, void *data)
{
- TSAssert((event == TS_EVENT_NET_ACCEPT) || (event == TS_EVENT_NET_ACCEPT_FAILED));
+ if (event != TS_EVENT_NET_ACCEPT && event != TS_EVENT_NET_ACCEPT_FAILED) {
+ int err = -static_cast<int>(reinterpret_cast<intptr_t>(data));
+ if (err > 0 && err < 256) {
Review Comment:
`data` is treated as a negated errno via `reinterpret_cast<intptr_t>(data)` and then narrowed to `int` before negation. If `data` is actually a pointer (plausible for many events), the narrowing conversion can wrap/lose bits and accidentally produce a small positive value (e.g., <256), leading to a misleading `strerror()` message. Consider keeping the value as `intptr_t`, first checking it’s in a plausible negated-errno range (e.g., `< 0` and `>= -4095`), and only then converting to an `int` errno; otherwise log the raw integer/pointer value.
```suggestion
intptr_t data_val = reinterpret_cast<intptr_t>(data);
if (data_val < 0 && data_val >= -4095) {
int err = static_cast<int>(-data_val);
```
##########
src/api/InkAPITest.cc:
##########
@@ -913,7 +920,14 @@ synserver_vc_refuse(TSCont contp, TSEvent event, void *data)
static int
synserver_vc_accept(TSCont contp, TSEvent event, void *data)
{
- TSAssert((event == TS_EVENT_NET_ACCEPT) || (event == TS_EVENT_NET_ACCEPT_FAILED));
+ if (event != TS_EVENT_NET_ACCEPT && event != TS_EVENT_NET_ACCEPT_FAILED) {
+ int err = -static_cast<int>(reinterpret_cast<intptr_t>(data));
+ if (err > 0 && err < 256) {
+ ink_abort("synserver_vc_accept: unexpected event %d, accept errno: %s (%d)", event, strerror(err), err);
+ } else {
Review Comment:
Same issue here as in `synserver_vc_refuse`: narrowing `reinterpret_cast<intptr_t>(data)` to `int` before validating it can mis-identify arbitrary pointers as small errno values and print an incorrect `strerror()` string. To keep the diagnostics trustworthy, validate `data` as a plausible negated errno in `intptr_t` space (e.g., `<0` and within a small bound like 4095) before converting/logging it as an errno; otherwise log the raw value.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] synserver accept assertion to log event details before aborting [trafficserver]
Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall commented on PR #12903:
URL: https://github.com/apache/trafficserver/pull/12903#issuecomment-3937804074
[approve ci autest 1]
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] synserver accept assertion to log event details before aborting [trafficserver]
Posted by "bryancall (via GitHub)" <gi...@apache.org>.
bryancall merged PR #12903:
URL: https://github.com/apache/trafficserver/pull/12903
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org