Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I get the following error while installing glib.

ERROR:thread.c:147:test_thread4: assertion failed: (thread == NULL).

Can anyone let me know what is the issue?

share|improve this question
Praveen please upvote to kamil and mark as accepted answer for his amazing way to solve your problem – user61928 Sep 26 '12 at 7:46

Remember that make check in glib comes in last. make check depends on the desktop-file-utils-0.20, which in turn depend on an installed glib, so that one should make sure that the desktop-file-utils are installed, working and at a correct version before running make check. The canonical way would be to first install the new glibc, then desktop-file-utils, and then, at the very end, do make check.

In general, an error during check is a reason to worry, at least in a professional setting. Failure of a test may mean that some particular condition can bring the system to its knees, even if the system runs fine 99.99% of the time.

In this particular case, you can directly look into the source code of glib to understand what is happening. Here is the relevant function:

/* test that thread creation fails as expected,
 * by setting RLIMIT_NPROC ridiculously low
static void
test_thread4 (void)
  struct rlimit ol, nl;
  GThread *thread;
  GError *error;
  gint ret;

  getrlimit (RLIMIT_NPROC, &nl);
  nl.rlim_cur = 1;

  if ((ret = prlimit (getpid(), RLIMIT_NPROC, &nl, &ol)) != 0)
    g_error ("prlimit failed: %s\n", g_strerror (ret));

  error = NULL;
  thread = g_thread_try_new ("a", thread1_func, NULL, &error);
  g_assert (thread == NULL);
  g_assert_error (error, G_THREAD_ERROR, G_THREAD_ERROR_AGAIN);
  g_error_free (error);

  if ((ret = prlimit (getpid (), RLIMIT_NPROC, &ol, NULL)) != 0)
    g_error ("resetting RLIMIT_NPROC failed: %s\n", g_strerror (ret));

The error occurs ad the line

g_assert( thread == NULL ) ;

The test function changes the RLIMIT_PROC to a value of 1 (nl.rlim_cur=1, which limits the number of threads the current process can have). With that setting, creation of a new thread (g_thread_try_new() call) should fail and return NULL. For some reason, this does not happen.

Either there is a bug in the test suite, or a problem with glibc, or there was a problem correctly building glibc. In any case, incorrect return values from thread management library calls would make me very nervous.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.