Skip to content

Mark H2 connection inactive only if it is NOT shutting down - #4936

Merged
masaori335 merged 1 commit into
apache:masterfrom
masaori335:4504-take2
Feb 8, 2019
Merged

masaori335 merged 1 commit into
apache:masterfrom
masaori335:4504-take2

Conversation

@masaori335

Copy link
Copy Markdown
Contributor

Prior this change, HTTP/2 connection is marked as inactive regardless it is shutting down or not.
I think we don't need to add it to keep-alive queue, if it is shutting down.

Fix #4504

@masaori335 masaori335 added this to the 9.0.0 milestone Feb 6, 2019
@masaori335 masaori335 self-assigned this Feb 6, 2019
Prior this change, HTTP/2 connection is marked as inactive regardless it is shutting down or not.
UnixNetVConnection *vc = static_cast<UnixNetVConnection *>(ua_session->get_netvc());
if (vc && vc->active_timeout_in == 0) {
// With heavy traffic, ua_session could be destroyed. Do not touch ua_session after this.
vc->add_to_keep_alive_queue();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, however, will Http2ClientSesion::destroy() be called somewhere in vc->add_to_keep_alive_queue() when it frees a session?
I'm not sure if it can be a problem, but if the destroy() wasn't called, it means SSN_CLOSE event wouldn't be fired on the session.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When vc->add_to_keep_alive_queue() close connection, VC_EVENT_INACTIVITY_TIMEOUT (105) comes to Http2ClientSession::main_event_handler(). It looks like it calls Http2ClientSession::destroy() eventually.

Below is backtrace from VC_EVENT_INACTIVITY_TIMEOUT (105) event on Http2ClientSession::main_event_handler() to Http2ClientSession::destroy().

(lldb) bt
* thread #2, name = '[ET_NET 4]', stop reason = step in
  * frame #0: 0x00000001001b81d0 traffic_server`Http2ClientSession::destroy(this=0x00000000077ecb00) at Http2ClientSession.cc:66
    frame #1: 0x00000001001c16ac traffic_server`Http2ConnectionState::release_stream(this=0x00000000077ece10, stream=0x0000000000000000) at Http2ConnectionState.cc:1254
    frame #2: 0x00000001001bf7a8 traffic_server`Http2ConnectionState::main_event_handler(this=0x00000000077ece10, event=2252, edata=0x00000000077ecb00) at Http2ConnectionState.cc:910
    frame #3: 0x0000000100017bd1 traffic_server`Continuation::handleEvent(this=0x00000000077ece10, event=2252, data=0x00000000077ecb00) at I_Continuation.h:190
    frame #4: 0x00000001001b997c traffic_server`send_connection_event(cont=0x00000000077ece10, event=2252, edata=0x00000000077ecb00) at Http2ClientSession.cc:58
    frame #5: 0x00000001001ba3f4 traffic_server`Http2ClientSession::do_io_close(this=0x00000000077ecb00, alerrno=-1) at Http2ClientSession.cc:259
    frame #6: 0x00000001001b8f47 traffic_server`Http2ClientSession::main_event_handler(this=0x00000000077ecb00, event=105, edata=0x0000000000fe4d88) at Http2ClientSession.cc:333

@shinrich shinrich left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me too. Basically you are moving the active to inactive logic later to only apply to sessions that aren't in the process of shutting down. That should simplify the shutdown sequence where you really just need to mark the session as going away not bothering with putting into the keep alive queue.

@masaori335
masaori335 merged commit a422774 into apache:master Feb 8, 2019
@zwoop

zwoop commented Feb 8, 2019

Copy link
Copy Markdown
Contributor

Please make a PR for 7.1.x please, looks good so far on 8.

@zwoop

zwoop commented Feb 11, 2019

Copy link
Copy Markdown
Contributor

Cherry-picked to 8.0.x

@zwoop zwoop modified the milestones: 9.0.0, 8.0.3 Feb 11, 2019
masaori335 pushed a commit to masaori335/trafficserver that referenced this pull request Apr 27, 2020
Prior this change, HTTP/2 connection is marked as inactive regardless it is shutting down or not.
I think we don't need to add it to keep-alive queue, if it is shutting down.

Fix apache#4504

This is a cherry-pick of apache#4936
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants