Subject: lib/24023: pthread assertion failure
To: None <>
From: Min Sik Kim <>
List: netbsd-bugs
Date: 01/08/2004 10:52:30
>Number:         24023
>Category:       lib
>Synopsis:       pthread assertion failure
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 08 16:53:00 UTC 2004
>Originator:     Min Sik Kim
>Release:        NetBSD 1.6ZG
System: NetBSD 1.6ZG NetBSD 1.6ZG (SULLEY) #1: Tue Dec 16 01:53:13 CST 2003 i386
Architecture: i386
Machine: i386
An assertion failed in pthread while I was packaging
gnome-terminal-2.4.2.  gnome-terminal tests all possible charsets
using iconv to figure out which ones are available.  After trying
about 30 charsets, iconv_close() dumps core due to assertion failure
in pthread codes.

A *streamlined* version of gnome-terminal is attached below.  It
iterates over 32 charsets, calling iconv_open() and iconv_close() for


... (OK for 27 charsets)

DEBUG: testing charset GB18030.
DEBUG: Available
assertion "next != 0" failed: file "/usr/src/lib/libpthread/pthread_run.c", line 123, function "pthread__next"
Abort (core dumped)

I compiled this with the following command.

  cc -pthread -o terminal terminal.c

Without '-pthread', it runs well.  The assertion failure happens only
when '-pthread' is given.  I'm running one-month old -current (1.6ZG)
on i386.

Compile the following program with '-pthread' option and run it.

terminal.c =============================================================
#include <stdio.h>
#include <iconv.h>

const int N_CHARSETS = 32;

static char *charsets[] = {

int main()
  int i;
  iconv_t cd;

  for (i = 0; i < N_CHARSETS; i++) {
    cd = iconv_open (charsets[i], charsets[i]);
    fprintf(stderr, "DEBUG: testing charset %s.\n", charsets[i]);
    if (cd != (iconv_t)-1) {
      fprintf(stderr, "DEBUG: Available\n");
    } else {
      fprintf(stderr, "DEBUG: Not available.\n");
    fprintf(stderr, "DEBUG: Done.\n\n");
  return 0;