-
Notifications
You must be signed in to change notification settings - Fork 857
Add zombie-event option to debug leaked Http2ClientSessions. #3713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -73,6 +73,10 @@ rcv_data_frame(Http2ConnectionState &cstate, const Http2Frame &frame) | |
|
|
||
| Http2StreamDebug(cstate.ua_session, id, "Received DATA frame"); | ||
|
|
||
| if (cstate.get_zombie_event()) { | ||
| Warning("Data frame for zombied session %" PRId64, cstate.ua_session->connection_id()); | ||
| } | ||
|
|
||
| // If a DATA frame is received whose stream identifier field is 0x0, the | ||
| // recipient MUST | ||
| // respond with a connection error of type PROTOCOL_ERROR. | ||
|
|
@@ -363,6 +367,10 @@ rcv_priority_frame(Http2ConnectionState &cstate, const Http2Frame &frame) | |
|
|
||
| Http2StreamDebug(cstate.ua_session, stream_id, "Received PRIORITY frame"); | ||
|
|
||
| if (cstate.get_zombie_event()) { | ||
| Warning("Priority frame for zombied sessoin %" PRId64, cstate.ua_session->connection_id()); | ||
| } | ||
|
|
||
| // If a PRIORITY frame is received with a stream identifier of 0x0, the | ||
| // recipient MUST respond with a connection error of type PROTOCOL_ERROR. | ||
| if (stream_id == 0) { | ||
|
|
@@ -488,6 +496,10 @@ rcv_settings_frame(Http2ConnectionState &cstate, const Http2Frame &frame) | |
|
|
||
| Http2StreamDebug(cstate.ua_session, stream_id, "Received SETTINGS frame"); | ||
|
|
||
| if (cstate.get_zombie_event()) { | ||
| Warning("Setting frame for zombied sessoin %" PRId64, cstate.ua_session->connection_id()); | ||
| } | ||
|
|
||
| // [RFC 7540] 6.5. The stream identifier for a SETTINGS frame MUST be zero. | ||
| // If an endpoint receives a SETTINGS frame whose stream identifier field is | ||
| // anything other than 0x0, the endpoint MUST respond with a connection | ||
|
|
@@ -575,6 +587,8 @@ rcv_ping_frame(Http2ConnectionState &cstate, const Http2Frame &frame) | |
|
|
||
| Http2StreamDebug(cstate.ua_session, stream_id, "Received PING frame"); | ||
|
|
||
| cstate.schedule_zombie_event(); | ||
|
|
||
| // If a PING frame is received with a stream identifier field value other | ||
| // than 0x0, the recipient MUST respond with a connection error of type | ||
| // PROTOCOL_ERROR. | ||
|
|
@@ -840,7 +854,10 @@ static const http2_frame_dispatch frame_handlers[HTTP2_FRAME_TYPE_MAX] = { | |
| int | ||
| Http2ConnectionState::main_event_handler(int event, void *edata) | ||
| { | ||
| if (edata == fini_event) { | ||
| if (edata == zombie_event) { | ||
| // zombie session is still around. Assert | ||
| ink_release_assert(zombie_event == nullptr); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You might want something more like |
||
| } else if (edata == fini_event) { | ||
| fini_event = nullptr; | ||
| } | ||
| ++recursion; | ||
|
|
@@ -984,7 +1001,10 @@ Http2ConnectionState::main_event_handler(int event, void *edata) | |
| int | ||
| Http2ConnectionState::state_closed(int /* event */, void *edata) | ||
| { | ||
| if (edata == fini_event) { | ||
| if (edata == zombie_event) { | ||
| // Zombie session is still around. Assert! | ||
| ink_release_assert(zombie_event == nullptr); | ||
| } else if (edata == fini_event) { | ||
| fini_event = nullptr; | ||
| } | ||
| return 0; | ||
|
|
@@ -1057,6 +1077,11 @@ Http2ConnectionState::create_stream(Http2StreamId new_id, Http2Error &error) | |
| } | ||
| ++total_client_streams_count; | ||
|
|
||
| if (zombie_event != nullptr) { | ||
| zombie_event->cancel(); | ||
| zombie_event = nullptr; | ||
| } | ||
|
|
||
| new_stream->set_parent(ua_session); | ||
| new_stream->mutex = new_ProxyMutex(); | ||
| new_stream->is_first_transaction_flag = get_stream_requests() == 0; | ||
|
|
@@ -1222,7 +1247,11 @@ Http2ConnectionState::release_stream(Http2Stream *stream) | |
| // ua_session = nullptr; | ||
| } else if (shutdown_state == HTTP2_SHUTDOWN_IN_PROGRESS && fini_event == nullptr) { | ||
| fini_event = this_ethread()->schedule_imm_local((Continuation *)this, HTTP2_SESSION_EVENT_FINI); | ||
| } else { | ||
| schedule_zombie_event(); | ||
| } | ||
| } else if (fini_received) { | ||
| schedule_zombie_event(); | ||
| } | ||
| } | ||
| } | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
set_dying_event()is not called anywhere else in code. Should it be?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, all the dying eventually comes through this handler.