Skip to content

Commit 5b032ba

Browse files
committed
TS-4796 Change UnixNetHandler to always bubble up epoll errors to the VConnection
Before if the vcon wasn't read or write enabled errors would be swallowed. This leads to a variety of issues where the socket errors aren't dealt with immediately.
1 parent 5063618 commit 5b032ba

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

iocore/net/P_UnixNetVConnection.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,10 @@ UnixNetVConnection::set_action(Continuation *c)
498498
// declarations for local use (within the net module)
499499

500500
void close_UnixNetVConnection(UnixNetVConnection *vc, EThread *t);
501+
502+
int read_signal_error(NetHandler *nh, UnixNetVConnection *vc, int lerrno);
503+
int write_signal_error(NetHandler *nh, UnixNetVConnection *vc, int lerrno);
504+
501505
void write_to_net(NetHandler *nh, UnixNetVConnection *vc, EThread *thread);
502506
void write_to_net_io(NetHandler *nh, UnixNetVConnection *vc, EThread *thread);
503507

iocore/net/UnixNet.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,17 @@ NetHandler::mainNetEvent(int event, Event *e)
465465
epd = (EventIO *)get_ev_data(pd, x);
466466
if (epd->type == EVENTIO_READWRITE_VC) {
467467
vc = epd->data.vc;
468+
int eventio_error_num = get_ev_events(pd, x) & EVENTIO_ERROR;
469+
if (eventio_error_num != 0) {
470+
// if the error was on the READ side, lets signal a read error
471+
if (get_ev_events(pd, x) & EVENTIO_READ) {
472+
read_signal_error(this, vc, eventio_error_num);
473+
} else { // otherwise it must be on the WRITE side, lets signal a write error
474+
write_signal_error(this, vc, eventio_error_num);
475+
}
476+
// Since we just killed the VC-- there is no reason to run the rest of this look
477+
continue;
478+
}
468479
if (get_ev_events(pd, x) & (EVENTIO_READ | EVENTIO_ERROR)) {
469480
vc->read.triggered = 1;
470481
if (!read_ready_list.in(vc)) {

iocore/net/UnixNetVConnection.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,14 +231,14 @@ write_signal_done(int event, NetHandler *nh, UnixNetVConnection *vc)
231231
}
232232
}
233233

234-
static inline int
234+
int
235235
read_signal_error(NetHandler *nh, UnixNetVConnection *vc, int lerrno)
236236
{
237237
vc->lerrno = lerrno;
238238
return read_signal_done(VC_EVENT_ERROR, nh, vc);
239239
}
240240

241-
static inline int
241+
int
242242
write_signal_error(NetHandler *nh, UnixNetVConnection *vc, int lerrno)
243243
{
244244
vc->lerrno = lerrno;

0 commit comments

Comments
 (0)