threads/94176: KSE: sigwait doesn't recieve SIGWINCH sent by pthread_kill() or kill -WINCH

john gladkih john at kak-sam.to
Tue Mar 7 08:20:31 PST 2006


>Number:         94176
>Category:       threads
>Synopsis:       KSE: sigwait doesn't recieve SIGWINCH sent by pthread_kill() or kill -WINCH
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-threads
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Mar 07 16:20:04 GMT 2006
>Closed-Date:
>Last-Modified:
>Originator:     john gladkih
>Release:        5.4-RELEASE, 5.3-RELEASE
>Organization:
>Environment:
FreeBSD freebsd54.i.drweb.ru 5.4-RELEASE FreeBSD 5.4-RELEASE #0: Sun May  8 10:21:06 UTC 2005     root at harlow.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386

>Description:
sigwait() doesn't recieve SIGWINCH (SIGIO and maybe some others signal) sent by pthread_kill() from another thread or even from kill -WINCH. there is no such issue on 5.2.1 and older with libc_r.
>How-To-Repeat:
[~]> cat t.cc 
#include <pthread.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>

sigset_t blk;

void *thread( void* ) {
  pthread_sigmask( SIG_BLOCK, &blk, NULL );
  printf( "sigwait()\n" );
  int sig, rc = sigwait( &blk, &sig );
  printf( "got %d (rc=%d)\n", sig, rc );
  printf( "no bug!\n" );
  _exit( 0 );
}

int main() {
  sigemptyset( &blk );
  sigaddset( &blk, SIGWINCH );

  sigprocmask( SIG_BLOCK, &blk, NULL );
  pthread_sigmask( SIG_BLOCK, &blk, NULL );

  pthread_attr_t attr;
  pthread_t tid;
  
  pthread_attr_init( &attr );
  pthread_attr_setdetachstate( &attr, PTHREAD_CREATE_DETACHED );
  pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM );

  printf( "pthread_create=%d\n", pthread_create( &tid, &attr, thread, 0 ) );
  pthread_attr_destroy( &attr );

  sleep( 5 );
  printf( "pthread_kill=%d\n", pthread_kill( tid, SIGWINCH ) );
  sleep( 5 );
  printf( "bug!\n" );
  return 1;
}
[~]> g++ -o t t.cc -lpthread
[~]> ./t
sigwait()
pthread_create=0
pthread_kill=0
bug!

>Fix:

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


More information about the freebsd-threads mailing list