PYTHON - socket "[Errorno 105] Buffer space not available" after 10 hours of execution

I implemented a code that sends pings to different destinations in a continuous way, but after a 10-hour run cycle, the socket I use depends on some kind of aging, which causes the application to stop using "[Errorno 105] There is no free space in the buffer" . How to MONITOR and SOLVE this problem?

Just for information, after opening, I always use the same socket to send and receive messages: can the socket periodically solve the problem?

SENDER CODE

import socket icmp = socket.getprotobyname('icmp') self.socket = socket.socket(socket.AF_INET,socket.SOCK_RAW,icmp) for target in target_list: #... packet = header+data while packet: sent = self.socket.sendto(packet,(target, 1)) packet = packet[sent:] 

RECEIVER CODE

 import select whatReady = select.select([self.socket],[],[]) if whatReady[0] != []: for skt in whatReady[0]: #... (recPacket,addr) = self.socket.recvfrom(self.PACKET_SIZE+64) 

NOTES:

  • self.socket is the same object reference for both modules.
  • I never close or change self.socket at runtime.
  • self.PACKET_SIZE = 32 (bytes)
+6
source share

Source: https://habr.com/ru/post/947092/


All Articles