Print this page
NEX-19665 Several door servers don't properly handle exiting threads
Review by: Gordon Ross <gordon.ross@nexenta.com>
Review by: Evan Layton <evan.layton@nexenta.com>
*** 19,28 ****
--- 19,29 ----
* CDDL HEADER END
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
+ * Copyright 2019 Nexenta Systems, Inc.
*/
/*
* Simple doors ldap cache daemon
*/
*** 223,239 ****
/*ARGSUSED*/
static void *
server_tsd_bind(void *arg)
{
! static void *value = 0;
/*
* disable cancellation to prevent hangs when server
* threads disappear
*/
!
(void) thr_setspecific(server_key, value);
(void) door_return(NULL, 0, NULL, 0);
return (value);
}
--- 224,240 ----
/*ARGSUSED*/
static void *
server_tsd_bind(void *arg)
{
! static void *value = "NON-NULL TSD";
/*
* disable cancellation to prevent hangs when server
* threads disappear
*/
! (void) pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
(void) thr_setspecific(server_key, value);
(void) door_return(NULL, 0, NULL, 0);
return (value);
}
*** 266,275 ****
--- 267,277 ----
server_destroy(void *arg)
{
(void) mutex_lock(&create_lock);
num_servers--;
(void) mutex_unlock(&create_lock);
+ (void) thr_setspecific(server_key, NULL);
}
static void client_killserver();
int