[erlang-bugs] 100% CPU usage on Mac OS X Leopard after peer closes socket
Bjorn Gustavsson
bjorn@REDACTED
Fri Apr 18 11:37:03 CEST 2008
Matthias Radestock <matthias@REDACTED> writes:
> On Mac OS X Leopard this results in {error,einval} being returned
> (which is expected) and the beam process subsequently consuming 100%
> CPU (though the Erlang shell remains responsive).
A simple patch that eliminates problem follows. It has not yet been
tested in our daily builds on multiple platforms, but it does eliminate
the problem on Mac OS 10.5.2 and we don't expect it to cause problems
on other platforms. (We are considering fixing the problem in a different way
in the R12B-3 release.)
Note that the return value from sock_spin:broken/1 will now be {error,closed},
which is that it returns on other platforms.
/Bjorn
--- erts/emulator/drivers/common/inet_drv.c.ORIG 2008-04-18 11:21:39.000000000 +0200
+++ erts/emulator/drivers/common/inet_drv.c 2008-04-18 11:22:42.000000000 +0200
@@ -8924,6 +8924,7 @@
code = sock_peer(desc->inet.s,(struct sockaddr*) &other,&sz);
if ((code == SOCKET_ERROR) && (sock_errno() == ENOTCONN ||
+ sock_errno() == EINVAL ||
sock_errno() == EPIPE)) {
DEBUGF(("driver_failure_eof(%ld) in %s, line %d\r\n",
(long)desc->inet.port, __FILE__, __LINE__));
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-bugs
mailing list