NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Out of threads



Hello

I have a problem with Apache, that sometimes horribly dies with this
message:
Can't initialize threads: error 35

The strings is from libmysqlclient. In MySQL source, we have:
mysql-5.6.23/mysys/my_thr_init.c
  if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
  {
    fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret);
    return 1; 
  }

In NetBSD, src/lib/libpthread/pthread_tsd.c
        for (i = nextkey; i < PTHREAD_KEYS_MAX; i++)
                if (pthread__tsd_alloc[i] == NULL)
                        break;

        if (i == PTHREAD_KEYS_MAX) {
                /* 2. If that didn't work, search from the start
                 *    of the list back to "nextkey".
                 */
                for (i = 0; i < nextkey; i++)
                        if (pthread__tsd_alloc[i] == NULL)
                                break;

                if (i == nextkey) {
                        /* If we didn't find one here, there isn't one
                         * to be found.
                         */
                        pthread_mutex_unlock(&tsd_mutex);
                        return EAGAIN;

We hit a hardcoded value here, which is set to 256 in <limits.h>. Anyone
encountered this? Is there other workarounds than rebuilding libpthread
with a higher PTHREAD_KEYS_MAX? In an ideal world, we could throttle on
failure, instead of exitting.


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index