Assertion failed or Segmentation Fault when creating lots of threads. #154

davrodpin opened this Issue Jan 6, 2010 · 2 comments

3 participants


I did compile rubinius without llvm on a CenOS 5.4 and create a program to spawn lots of threads.

Whem it reaches a certain number os threads, raises an segmentation fault or in some cases, even before create the threads an error occurs. Some specific information about the problem:

  • test_threads.rb

$pool = []

NTHREADS.to_i.times do |n|
  $pool << do
    loop { sleep 0.025 }

loop do
  puts "+ #{$pool.size.to_s} threads running."
  sleep 1

  • Machine

CentOS 5.4

  • Errors

++ Running with 730 threads: execution is ok.

++Running with 751 threads: after 17 seconds of execution, the following error raises:

mmap: Cannot allocate memory

++ Running with 752+ threads:

Sometimes it raises the following error just after the execution:

rbx: vm/util/thread.hpp:115: void thread::Thread::run(): Assertion `pthread_create(&native_, &attrs, trampoline, (void*)this) == 0' failed.

Sometimes, after 10-15 seconds of execution, it raises:

Segmentation Fault
Rubinius member

You've hit two bugs at once here I think, Evan fixed an issue in the GC in commit defd53a and I've fixed the issue that it should not segfault but throw a ThreadError if it can't create more threads in commit 0bec6e5.

Could you test it again?

Rubinius member

No word, assuming fixed.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment