Skip to content

Conversation

@shinrich
Copy link
Member

@shinrich shinrich commented Jul 26, 2018

Added this logic while debugging an openssl engine using ASYNC jobs. This and PR #4019 are underlying issues I fixed that were revealed by the timing differences of the engine.

This PR cleans up any VIOs against the the HttpSM that is being killed. This ends up preventing inactivity timeouts on stale HttpSM's.

Http1ClientSession::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
{
return client_vc->do_io_read(c, nbytes, buf);
if (client_vc) {
Copy link
Member

@SolidWallOfCode SolidWallOfCode Jul 31, 2018

Choose a reason for hiding this comment

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

return client_vc ? client_vc->do_io_read(c, nbytes, buf) : nullptr; ?

//
void
HttpVCTable::remove_entry(HttpVCTableEntry *e)
HttpVCTable::remove_entry(HttpVCTableEntry *e, HttpSM *sm)
Copy link
Member

Choose a reason for hiding this comment

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

If this is needed for various methods, perhaps HttpVCTable should be constructed with a reference to the HttpSM.

if (e->read_vio != nullptr && e->read_vio->cont == sm) {
// Cleanup dangling i/o
if (e == sm->get_ua_entry() && sm->get_ua_txn()) {
e->read_vio = sm->get_ua_txn()->do_io_read(NULL, 0, NULL);
Copy link
Member

Choose a reason for hiding this comment

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

No NULL.

Copy link
Member

Choose a reason for hiding this comment

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

The read_vio will get cleaned out later, so this doesn't repeatedly shut down IO?

}
if (e->read_vio != nullptr && e->read_vio->cont == sm) {
// Cleanup dangling i/o
if (e == sm->get_ua_entry() && sm->get_ua_txn()) {
Copy link
Member

Choose a reason for hiding this comment

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

style consistency - if you check vs. nullptr in the previous if, do that here too with sm->get_ua_txn().

break;
case VC_EVENT_ERROR:
case VC_EVENT_INACTIVITY_TIMEOUT:
case VC_EVENT_ACTIVE_TIMEOUT:
Copy link
Member

Choose a reason for hiding this comment

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

Where was VC_EVENT_ACTIVE_TIMEOUT handled before? Or was it not handled?

Copy link
Member Author

Choose a reason for hiding this comment

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

The active timeout was not handled before. Ran across it while debugging the ASYNC job. Should be handled here. I can pull it into a separate PR if necessary.

ink_assert(p->vc == server_session);

// The server session has been released. Clean all pointer
server_entry->in_tunnel = true; // to avid cleaning in clenup_entry
Copy link
Member

Choose a reason for hiding this comment

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

"cleanup_entry"

Copy link
Member

Choose a reason for hiding this comment

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

This seems an odd place to set in_tunnel to true.

Copy link
Member

Choose a reason for hiding this comment

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

"avoid" for "avid".

ua_txn->set_active_timeout(HRTIME_SECONDS(t_state.txn_conf->transaction_active_timeout_in));

p->vc->do_io_write(this, 0, nullptr);
p->vc->do_io_write(nullptr, 0, nullptr);
Copy link
Member

Choose a reason for hiding this comment

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

Ah, that's how you stop repeat shutdowns.

HttpServerSession::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
{
return server_vc->do_io_read(c, nbytes, buf);
if (server_vc) {
Copy link
Member

Choose a reason for hiding this comment

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

I suppose it's just a style thing, but I prefer the single return with ternary style.

@shinrich
Copy link
Member Author

Pushed a new version which should address Alan's concerns.

HttpVCTable::HttpVCTable(HttpSM *mysm)
{
memset(&vc_table, 0, sizeof(vc_table));
sm = mysm;
Copy link
Member

Choose a reason for hiding this comment

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

Use member initializer. E.g.
HttpVCTable::HttpVCTable(HttpSM *state_machine) : sm(state_machine)

Http1ClientSession::do_io_read(Continuation *c, int64_t nbytes, MIOBuffer *buf)
{
return client_vc->do_io_read(c, nbytes, buf);
return (client_vc) ? client_vc->do_io_read(c, nbytes, buf) : nullptr;
Copy link
Member

Choose a reason for hiding this comment

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

Why the parentheses around client_vc?

@shinrich shinrich merged commit 61c49ea into apache:master Aug 1, 2018
@zwoop
Copy link
Contributor

zwoop commented Aug 29, 2018

I'm going to remove the 7.1.5 Project on this, since going forward, we will need to make a second PR against the 7.1.x for proposed back ports.

@bryancall
Copy link
Contributor

Cherry picked to 8.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants