Skip to contentSkip to conversation

hashserv: Ensure we don't accumulate sockets in TIME_WAIT state

PATCH New Richard Purdie 1 participant 2 messages Aug 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hashserv: Ensure we don't accumulate sockets in TIME_WAIT state

This can cause a huge backlog of closing sockets on the server and in our case we don't really want/need the protection TCP is trying to give us so work around it.

---
 lib/hashserv/__init__.py | 6 ++++++
 1 file changed, 6 insertions(+)
lib/hashserv/__init__.py +6 -0
index 55966e748a..eb03c32213 100644
@@ -14,6 +14,8 @@ import socketserver
 import queue
 import threading
 import signal
+import socket
+import struct
 from datetime import datetime
 
 logger = logging.getLogger('hashserv')
@@ -157,6 +159,10 @@ class ThreadedHTTPServer(HTTPServer):
         self.server_close()
         os._exit(0)
 
+    def server_bind(self):
+        HTTPServer.server_bind(self)
+        self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_LINGER, struct.pack('ii', 1, 0))
+
     def process_request_thread(self):
         while not self.quit:
             try:
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/2 runqueue: Ensure target_tids is filtered

bitbake <target> --runonly=fetch

failed as the target_tids list included entries which were no longer targeted task ids. Fix this.

---
 lib/bb/runqueue.py | 1 +
 1 file changed, 1 insertion(+)
lib/bb/runqueue.py +1 -0
index 4e64ddfdad..7fa074f679 100644
@@ -1736,6 +1736,7 @@ class RunQueueExecute:
         # We can't skip specified target tasks which aren't setscene tasks
         self.cantskip = set(self.rqdata.target_tids)
         self.cantskip.difference_update(self.rqdata.runq_setscene_tids)
+        self.cantskip.intersection_update(self.rqdata.runtaskentries)
 
         schedulers = self.get_schedulers()
         for scheduler in schedulers:
Signature · 1 line
2.20.1