From 235491231bdd1fd93507c835767503f047e10b91 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Sat, 22 Feb 2014 17:16:17 +0100 Subject: libports: work around bugs in server termination Most servers use ports_manage_port_operations_multithread 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_multithread not to return. * libports/manage-multithread.c (ports_manage_port_operations_multithread): Force global_timeout to 0. --- libports/manage-multithread.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libports/manage-multithread.c b/libports/manage-multithread.c index 64e442fe..2067cbaa 100644 --- a/libports/manage-multithread.c +++ b/libports/manage-multithread.c @@ -236,5 +236,11 @@ ports_manage_port_operations_multithread (struct port_bucket *bucket, return NULL; } + /* 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 + master thread from going away. */ + global_timeout = 0; + thread_function ((void *) 1); } -- cgit v1.2.3