Skip site navigation (1)Skip section navigation (2)
Date:      Wed,  7 Jun 2000 01:38:25 -0700 (PDT)
From:      bryanm@is.co.za
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/19087: selects always restart when using threads
Message-ID:  <20000607083825.CCB5037B8B2@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         19087
>Category:       misc
>Synopsis:       selects always restart when using threads
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jun 07 01:40:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Bryan Mawhinney
>Release:        4.0-RELEASE
>Organization:
The Internet Solution
>Environment:
FreeBSD some.host 4.0-RELEASE FreeBSD 4.0-RELEASE #2: Thu May 18 16:27:
16 SAST 2000      bryanm@is.co.za:/usr/src/sys/compile/VISP  i386
>Description:
Threads blocking on select default to being restarted after
signals.  Shouldn't the default be to interrupt, given that
these are POSIX threads?

Calling siginterrupt(1) doesn't help, since it isn't thread aware.
One has to use sigaction to explicity set sa_flags to 0 to get
the POSIX behaviour.

>How-To-Repeat:
In a threaded app (eg, slapd from openldap-1.2.10):

int shutdown = 0;
signal( SIGTERM, set_shutdown)

while (!shutdown) {
  i = select( nfds, &readfds, &writefds, 0, 0)
  ...
}

void set_shutdown( int sig )
{
  shutdown = 1
}

In response to a SIGTERM, shutdown is set to 1, but if the fds
are idle, the process never exits because the select restarts
each time.

>Fix:
libc_r includes an implementation of signal which implements
the POSIX semantics, but it is not listed in HIDDEN_SYSCALLS,
so the libc implementation gets used anyway.

Is this an oversight, or is this merely a porting issue?
Are there any other side effects due to calling the libc signal?


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000607083825.CCB5037B8B2>