diff options
author | Sverker Eriksson <[email protected]> | 2018-11-28 20:31:37 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-11-28 20:32:23 +0100 |
commit | 06c46662022efb6892c036eeaf8c957e51fc17f7 (patch) | |
tree | 592110ed892da08874980e0ce369f1b30f5b7d31 /erts | |
parent | 0ad63bcc5523f0b560c843b3ed02c08e1369e522 (diff) | |
download | otp-06c46662022efb6892c036eeaf8c957e51fc17f7.tar.gz otp-06c46662022efb6892c036eeaf8c957e51fc17f7.tar.bz2 otp-06c46662022efb6892c036eeaf8c957e51fc17f7.zip |
erts: Fix unexpected inet_reply message from failing file:sendfile
A failing file:sendfile call would often send a message
{inet_reply, Port, {error, Reason}} that would pollute the mailbox
of the calling process.
TCP_REQ_SENDFILE has its own reply messages format
{sendfile, _, _} and does not expect an inet_reply message.
Solution: Suppress inet_reply error message if TCP_ADDF_SENDFILE
is set.
Diffstat (limited to 'erts')
-rw-r--r-- | erts/emulator/drivers/common/inet_drv.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/erts/emulator/drivers/common/inet_drv.c b/erts/emulator/drivers/common/inet_drv.c index d8491ba18b..681909d9aa 100644 --- a/erts/emulator/drivers/common/inet_drv.c +++ b/erts/emulator/drivers/common/inet_drv.c @@ -11150,27 +11150,31 @@ static int tcp_send_or_shutdown_error(tcp_descriptor* desc, int err) DEBUGF(("driver_failure_eof(%ld) in %s, line %d\r\n", (long)desc->inet.port, __FILE__, __LINE__)); if (desc->inet.active) { + ErlDrvTermData err_atom; if (show_econnreset) { tcp_error_message(desc, err); - tcp_closed_message(desc); - inet_reply_error(INETP(desc), err); + err_atom = error_atom(err); } else { - tcp_closed_message(desc); - inet_reply_error_am(INETP(desc), am_closed); + err_atom = am_closed; } + tcp_closed_message(desc); + if (!(desc->tcp_add_flags & TCP_ADDF_SENDFILE)) + inet_reply_error_am(INETP(desc), err_atom); + if (desc->inet.exitf) driver_exit(desc->inet.port, 0); else tcp_desc_close(desc); } else { tcp_close_check(desc); - tcp_desc_close(desc); if (desc->inet.caller) { - if (show_econnreset) - inet_reply_error(INETP(desc), err); - else - inet_reply_error_am(INETP(desc), am_closed); + if (!(desc->tcp_add_flags & TCP_ADDF_SENDFILE)) { + if (show_econnreset) + inet_reply_error(INETP(desc), err); + else + inet_reply_error_am(INETP(desc), am_closed); + } } else { /* No blocking send op to reply to right now. @@ -11179,6 +11183,7 @@ static int tcp_send_or_shutdown_error(tcp_descriptor* desc, int err) */ desc->tcp_add_flags |= TCP_ADDF_DELAYED_CLOSE_SEND; } + tcp_desc_close(desc); /* * Make sure that the next receive operation gets an {error,closed} |