# Problem using an external thread with ruby

**URL:** <https://www.ruby-forum.com/t/problem-using-an-external-thread-with-ruby/197417>\
**Category:** Ruby\
**Created:** [October 14, 2010, 8:00am UTC](https://www.ruby-forum.com/t/problem-using-an-external-thread-with-ruby/197417 "2010-10-14T08:00:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [October 14, 2010, 8:00am UTC](https://www.ruby-forum.com/t/problem-using-an-external-thread-with-ruby/197417/1 "2010-10-14T08:00:44Z")

</div>

-----BEGIN PGP SIGNED MESSAGE-----  
Hash: SHA1

Hi,

I have an problem …  
I create an external thread with pthread\_create and  
create new ruby objects in this thread. it seems  
to work until the GC is running.

#0 mark\_locations\_array (objspace=0x603d30, th=0x6039b0) at  
…/gc.c:1315  
#1 gc\_mark\_locations (objspace=0x603d30, th=0x6039b0) at …/gc.c:1331  
#2 mark\_current\_machine\_context (objspace=0x603d30, th=0x6039b0) at  
…/gc.c:2128  
#3 0x00007ffff7a2b665 in garbage\_collect (objspace=0x603d30) at  
…/gc.c:2177  
#4 0x00007ffff7a2c247 in rb\_newobj\_from\_heap () at …/gc.c:1014  
#5 rb\_newobj () at …/gc.c:1097  
#6 0x00007ffff7a2c306 in rb\_data\_typed\_object\_alloc (klass=6638120,  
datap=0x808040, type=0x7ffff7dbf200) at …/gc.c:1132  
#7 0x00007ffff7a1c5a8 in mnew (klass=6363200, obj=6319120, id=, mclass=6638120, scope=0) at …/proc.c:967  
#8 0x00007ffff7b2c3ad in vm\_call\_cfunc (th=0x6039b0,  
cfp=0x7ffff7fd7e00, num=, blockptr=,  
flag=, id=, me=0x6ffdb0,  
recv=6319120) at …/vm\_insnhelper.c:401  
#9 vm\_call\_method (th=0x6039b0, cfp=0x7ffff7fd7e00, num=, blockptr=,  
flag=, id=, me=0x6ffdb0,  
recv=6319120) at …/vm\_insnhelper.c:523  
#10 0x00007ffff7b20fc8 in vm\_exec\_core (th=,  
th=) at insns.def:1006  
#11 0x00007ffff7b26951 in vm\_exec (th=0x6039b0) at …/vm.c:1145  
#12 0x00007ffff7b27c54 in vm\_call0 (th=0x6039b0, recv=6319120, id=12565,  
argc=0, argv=0x0, me=) at …/vm\_eval.c:66  
#13 0x00007ffff7a1bedb in rb\_method\_call (argc=0, argv=0x0,  
method=) at …/proc.c:1421  
#14 0x00007ffff7a174cb in rb\_rescue2 (b\_proc=0x7ffff6565ca0  
, data1=6319000, r\_proc=0x7ffff6565cb0 ,

the debugger display an extremely high stack-end in the thread struct:

machine\_stack\_start → 8  
machine\_stack\_end → 140737348020529  
machine\_stack\_maxsize → 7340032

- → well it seems that a “initialization” have to run first
- → is a hint available?

thanks for help, Andreas O.  
-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v2.0.15 (GNU/Linux)  
Comment: Using GnuPG with SUSE - [http://enigmail.mozdev.org/](http://enigmail.mozdev.org/)

iQEcBAEBAgAGBQJMtprdAAoJEGTcPijNG3/ATG0IAJBdgdnptf8LfUIQDmW1jJp5  
pnmf8cYOSwh1HCI7+7iYYo90QUU5u1BNVwDXC4v7NwP++Opv3RNxTA+0+UMYy4dw  
N+5bxnIsjEML8RKtxlmtbb6xaPJI/AFmoiELM4gohWsbdvmCR9Ic0WJq/gP9pJkQ  
CRVgPHVlJl/bcArJP7w5zp8jaUUQ8hvgKvbd3UMRwYLZIi8buv6OfljePOoK+GAz  
kaOcWjCap3G/Tf2ymDPpuLCLw+S6Zabw+wLabBi++iN4vl5kR4qLt0BWKAfhp6Sj  
MPE6VKyHMPonYQ5QuJ6PHpuwmLwmG28YVL5J8Tr6xyLawAB8I+DIgN5XYv4R7Dc=  
=Tlka  
-----END PGP SIGNATURE-----
