Skip to content
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

Do not callback one SM EVENT_ERROR twice. #1559

Merged
merged 1 commit into from
Mar 9, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 19 additions & 1 deletion iocore/net/UnixNetVConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,9 +271,22 @@ read_from_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)

// if it is a non-temporary error, we should die appropriately
if (err && err != EAGAIN && err != EINTR) {
read_signal_error(nh, vc, err);
Continuation *reader_cont = vc->read.vio._cont;

if (read_signal_error(nh, vc, err) == EVENT_DONE) {
return;
}
// If vc is closed or shutdown(WRITE) in last read_signal_error callback,
// or reader_cont is same as write.vio._cont.
Copy link
Contributor

Choose a reason for hiding this comment

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

Great comment, this really helps explaining the issue / solution.

// Then we must clear the write.error to avoid callback EVENT_ERROR to SM by write_ready_list.
if (vc->closed || (vc->f.shutdown & NET_VC_SHUTDOWN_WRITE) || reader_cont == vc->write.vio._cont) {
vc->write.error = 0;
}
return;
}

// clear read.error if it is non-fatal error
vc->read.error = 0;
}

// if it is not enabled.
Expand Down Expand Up @@ -450,9 +463,14 @@ write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread)
}

if (err && err != EAGAIN && err != EINTR) {
// Here is differ to net_read_io since read_signal_error always callback first.
// NetHandler::mainNetEvent() is always handle read_ready_list first and then write_ready_list.
write_signal_error(nh, vc, err);
return;
}

// clear write.error if it is non-fatal error.
vc->write.error = 0;
}

// This function will always return true unless
Expand Down