Repository navigation
Set HttpSM::tunnel_handler_post to handle write event for outputing HTTP 408 response. - #1583
Conversation
|
This sounds like a 7.1.0 candidate? |
|
@zwoop yes, 7.1.x is ok. |
|
This is running on Docs. |
|
I might be able to reproduce the issue, but only with H2. I couldn't reproduce it with H1. What I did are:
The patch fixes an abort issue but ATS still aborts. (Fails at another assert.) |
|
@zwoop @SolidWallOfCode |
|
@oknet The assert has gone. At least it works with H2. Thanks. |
|
|
||
| if (event != HTTP_TUNNEL_EVENT_DONE) { | ||
| if ((event == VC_EVENT_WRITE_COMPLETE) || (event == VC_EVENT_EOS)) { | ||
| if ((event == VC_EVENT_WRITE_COMPLETE) || (event == VC_EVENT_EOS) || (event == VC_EVENT_ERROR) || |
There was a problem hiding this comment.
@shinrich and I discussed this a bit. It's a big ugly to have these two long conditionals that are identical but not obviously so. What I would recommend is adding an inline function like isTxnTerminalEvent that covers EOS, ERROR, INACTIVITY_TIMEOUT and INACTIVITY_TIMEOUT and have
if (event == VC_EVENT_WRITE_COMPLETE || isEventTxTerminal(event)) {
which would be easier to understand and easier to see the set of events are the same here and on line 2784. Our opinion is this would be useful in no small number of other places in the code as well and help prevent problems like this in the future.
There was a problem hiding this comment.
I can rewrite it to switch-case :
switch (event) {
case VC_EVENT_WRITE_COMPLETE:
case VC_EVENT_EOS:
case VC_EVENT_ERROR:
case VC_EVENT_INACTIVITY_TIMEOUT:
case VC_EVENT_ACTIVE_TIMEOUT:
// do something
break;
default:
break;
}
There was a problem hiding this comment.
switch case is much ATS style than any others, more clear for Human reading.
There was a problem hiding this comment.
I think we should add the inline function to make sure that the same condition is used under the same context, and to clarify the condition we expect.
The switch case style is more readable than current style though, it doesn't tell us what the case is.
…TTP 408 response. If POST transform plugin does not finished before the ua_session timeouted, the producer will received a TIMEOUT event and callback producer_handler (HttpSM::tunnel_handler_post_ua). The HttpSM::tunnel_handler_post_ua will send a 408 response to client. The ua_session will received TIMEOUT event again in the next second because it does not reset the ua_session's timeout. The TIMEOUT event will be sent to HttpSM default handler because we did not save VIO returned by do_io_write to ua_entry->write_vio. The default handler is HttpSM::state_request_wait_for_transform_read and the TIMEOUT event is unexpected, then ink_release_asserti(0) at L1333 (at the end of HttpSM::state_common_wait_for_transform_read). In HttpSM::tunnel_handler_post(), calling tunnel_handler_post_or_put(p) before vc_table.cleanup_all() and tunnel.chain_abort_all(p).
|
clang-analyzer build successful! https://ci.trafficserver.apache.org/job/clang-analyzer-github/354/ |
|
I've been running with this on docs for a few days, with no problem. It does not seem to address the threads running at 100% CPU at times though. But assuming this fixes another problem, it seems safe and fine. |
If POST transform plugin does not finished before the ua_session timeouted, the producer will received a TIMEOUT event and callback producer_handler (HttpSM::tunnel_handler_post_ua).
The HttpSM::tunnel_handler_post_ua will send a 408 response to client.
The ua_session will received TIMEOUT event again in the next second because it does not reset the ua_session's timeout.
The TIMEOUT event will be sent to HttpSM default handler because we did not save VIO returned by do_io_write to ua_entry->write_vio.
The default handler is HttpSM::state_request_wait_for_transform_read and the TIMEOUT event is unexpected, then ink_release_asserti(0) at L1333 (at the end of HttpSM::state_common_wait_for_transform_read).