summaryrefslogtreecommitdiff
path: root/debian/patches/libports-termination-workaround.patch
diff options
context:
space:
mode:
Diffstat (limited to 'debian/patches/libports-termination-workaround.patch')
-rw-r--r--debian/patches/libports-termination-workaround.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/debian/patches/libports-termination-workaround.patch b/debian/patches/libports-termination-workaround.patch
new file mode 100644
index 00000000..196ca7b0
--- /dev/null
+++ b/debian/patches/libports-termination-workaround.patch
@@ -0,0 +1,38 @@
+commit cf01d40fb9e540c21138d40b8d3d5a4d1ac683c6
+Author: Justus Winter <4winter@informatik.uni-hamburg.de>
+Date: Thu Apr 17 15:43:11 2014 +0200
+
+ libports: work around bugs in server termination
+
+ Some servers use ports_manage_port_operations_one_thread to process
+ requests and terminate when it returns. Since many of them don't detach
+ before shutting down, a client may receive an error if its request
+ arrived while the server is shutting down. Prevent those spurious errors
+ by forcing ports_manage_port_operations_one_thread not to return.
+
+ This is the same change as 235491231bdd1fd93507c835767503f047e10b91
+ introduced for ports_manage_port_operations_multithread.
+
+ * libports/manage-one-thread.c
+ (ports_manage_port_operations_one_thread): Force timeout to 0.
+
+diff --git a/libports/manage-one-thread.c b/libports/manage-one-thread.c
+index 4ea740b..cbd2df7 100644
+--- a/libports/manage-one-thread.c
++++ b/libports/manage-one-thread.c
+@@ -85,7 +85,14 @@ ports_manage_port_operations_one_thread (struct port_bucket *bucket,
+
+ return status;
+ }
+-
++
++ /* XXX It is currently unsafe for most servers to terminate based on
++ inactivity because a request may arrive after a server has
++ started shutting down, causing the client to receive an error.
++ Prevent the service loop from terminating by setting TIMEOUT to
++ zero. */
++ timeout = 0;
++
+ do
+ err = mach_msg_server_timeout (internal_demuxer, 0, bucket->portset,
+ timeout ? MACH_RCV_TIMEOUT : 0, timeout);