From 35b2e56bd47bc300556cea282857eda4e9901de8 Mon Sep 17 00:00:00 2001 From: Alex Grintsvayg Date: Tue, 3 Jan 2017 19:13:16 -0500 Subject: [PATCH 1/3] silence "[Errno 11] Resource temporarily unavailable" error --- lbrynet/dht/protocol.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lbrynet/dht/protocol.py b/lbrynet/dht/protocol.py index 1939ead2e..063b9fb97 100644 --- a/lbrynet/dht/protocol.py +++ b/lbrynet/dht/protocol.py @@ -10,6 +10,8 @@ import logging import binascii import time +import socket +import errno from twisted.internet import protocol, defer from twisted.python import failure @@ -251,7 +253,13 @@ class KademliaProtocol(protocol.DatagramProtocol): def _write_and_remove(self, key, txData, address): del self._call_later_list[key] if self.transport: - self.transport.write(txData, address) + try: + # i'm scared this may swallow important errors, but i get a million of these + # on Linux and it doesnt seem to affect anything -grin + self.transport.write(txData, address) + except socket.error as err: + if err.errno != errno.EWOULDBLOCK: + raise err def _sendResponse(self, contact, rpcID, response): """ Send a RPC response to the specified contact From 71123c0de1df4030ad0bcab4b7db571b24906991 Mon Sep 17 00:00:00 2001 From: jobevers Date: Sat, 11 Feb 2017 08:49:59 -0600 Subject: [PATCH 2/3] add warning log on EWOULDBLOCK --- lbrynet/dht/protocol.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lbrynet/dht/protocol.py b/lbrynet/dht/protocol.py index 063b9fb97..a58d7ba8b 100644 --- a/lbrynet/dht/protocol.py +++ b/lbrynet/dht/protocol.py @@ -254,11 +254,13 @@ class KademliaProtocol(protocol.DatagramProtocol): del self._call_later_list[key] if self.transport: try: - # i'm scared this may swallow important errors, but i get a million of these - # on Linux and it doesnt seem to affect anything -grin self.transport.write(txData, address) except socket.error as err: - if err.errno != errno.EWOULDBLOCK: + if err.errno == errno.EWOULDBLOCK: + # i'm scared this may swallow important errors, but i get a million of these + # on Linux and it doesnt seem to affect anything -grin + log.warning("Can't send data to dht: EWOULDBLOCK") + else: raise err def _sendResponse(self, contact, rpcID, response): From f5e6ff0c32c2a19ff371913fdc71e73f75d6c66f Mon Sep 17 00:00:00 2001 From: jobevers Date: Sat, 11 Feb 2017 13:05:10 -0600 Subject: [PATCH 3/3] add changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee228b89d..bf7adb8a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ can and probably will change functionality and break backwards compatability at anytime. ## [Unreleased] +### Fixed + * Change EWOULDBLOCK error in DHT to warning. #481 ## [0.8.3rc0] - 2017-02-10 ### Changed