Another Segmentation Fault problem

Ok, I’m very new at programming in Ruby, so maybe I missed something.

I’ve built a multi-threaded web spider that uses “thread”, "net/http"
and “ncurses”. Occasionally it will segfault, usually down in the net
code. I’m running Red Hat 7.3 with all the latest updates. The
problem seemed to appear after I did an “apt-get dist-upgrade”, but
considering how intermittent it is, it might have been there before. Help?

– Matt

Hi,

···

In message “Another Segmentation Fault problem” on 02/08/04, Matt Lawrence matt@technoronin.com writes:

I’ve built a multi-threaded web spider that uses “thread”, “net/http”
and “ncurses”. Occasionally it will segfault, usually down in the net
code. I’m running Red Hat 7.3 with all the latest updates. The
problem seemed to appear after I did an “apt-get dist-upgrade”, but
considering how intermittent it is, it might have been there before. Help?

Show me the code if possible. And output from the following command:

ruby -v
uname -a

						matz.

Matt sent me a stack trace here:

Well… how about a stack trace for starters? It’s really hard to help
debug your program with no more information than this.

It’s a bit long, but here it is. I’ve never done any real software
development on Linux, so I am a bit lost.

Thanks for the help.

Program received signal SIGSEGV, Segmentation fault.
mark_locations_array (x=0x401fa380, n=1075755063) at gc.c:354
354 {
#0 mark_locations_array (x=0x401fa380, n=1075755063) at gc.c:354
x = (VALUE *) 0x40235000
n = 1075755063
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 1
#1 0x08066cf1 in rb_gc_mark_frame (frame=0x84cbf14) at gc.c:912
frame = (struct FRAME *) 0x84cbf14
#2 0x0805f325 in thread_mark (th=0x8138ae0) at eval.c:7196
th = 0x8138ae0
frame = (struct FRAME *) 0x84cbf14
block = (struct BLOCK *) 0x84cbf14
#3 0x08066777 in rb_gc_mark (ptr=0x4022d280) at gc.c:634
obj = (RVALUE *) 0x4022d280
#4 0x08066334 in mark_locations_array (x=0x839c250, n=1805) at gc.c:378
x = (VALUE *) 0x83ab0d0
n = 1805
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 1
#5 0x0805f2e5 in thread_mark (th=0x8139048) at eval.c:7188
th = 0x8139048
frame = (struct FRAME *) 0x4
block = (struct BLOCK *) 0x4
#6 0x08066777 in rb_gc_mark (ptr=0x4022cb14) at gc.c:634
obj = (RVALUE *) 0x4022cb14
#7 0x080667f3 in rb_gc_mark (ptr=0x401ebc7c) at gc.c:667
n = 0
vars = (VALUE *) 0x8196c18
obj = (RVALUE *) 0x0
#8 0x08066334 in mark_locations_array (x=0x8302218, n=14424) at gc.c:378
x = (VALUE *) 0x8306bcc
n = 14424
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 1
#9 0x0805f2e5 in thread_mark (th=0x8137cc0) at eval.c:7188
th = 0x8137cc0
frame = (struct FRAME *) 0x4
block = (struct BLOCK *) 0x4
#10 0x08066777 in rb_gc_mark (ptr=0x4022e3b0) at gc.c:634
obj = (RVALUE *) 0x4022e3b0
#11 0x0806672f in rb_gc_mark (ptr=0x4022e540) at gc.c:617
i = 1
len = 5
ptr = (VALUE *) 0x81372a8
obj = (RVALUE *) 0x81372a8
#12 0x08066334 in mark_locations_array (x=0x83b02e8, n=1815) at gc.c:378
x = (VALUE *) 0x83b4030
n = 1815
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 1
#13 0x0805f2e5 in thread_mark (th=0x8138560) at eval.c:7188
th = 0x8138560
frame = (struct FRAME *) 0x4
block = (struct BLOCK *) 0x4
#14 0x08066777 in rb_gc_mark (ptr=0x4022d71c) at gc.c:634
obj = (RVALUE *) 0x4022d71c
#15 0x080667f3 in rb_gc_mark (ptr=0x4020a230) at gc.c:667
n = 0
vars = (VALUE *) 0x8159290
obj = (RVALUE *) 0x0
#16 0x0805f263 in thread_mark (th=0x8283088) at eval.c:7176
th = 0x8283088
frame = (struct FRAME *) 0x401c1d10
block = (struct BLOCK *) 0x401c1d10
#17 0x08066777 in rb_gc_mark (ptr=0x4020a1e0) at gc.c:634
obj = (RVALUE *) 0x4020a1e0
#18 0x08066334 in mark_locations_array (x=0x8387c28, n=13940) at gc.c:378
x = (VALUE *) 0x8388e4c
n = 13940
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 1
#19 0x0805f2e5 in thread_mark (th=0x814b250) at eval.c:7188
th = 0x814b250
frame = (struct FRAME *) 0x4
block = (struct BLOCK *) 0x4
#20 0x08066777 in rb_gc_mark (ptr=0x4022ef7c) at gc.c:634
obj = (RVALUE *) 0x4022ef7c
#21 0x08066334 in mark_locations_array (x=0x8145568, n=5483) at gc.c:378
x = (VALUE *) 0x8145ca0
n = 5483
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 1
#22 0x0805f2e5 in thread_mark (th=0x81452b0) at eval.c:7188
th = 0x81452b0
frame = (struct FRAME *) 0x4
block = (struct BLOCK *) 0x4
#23 0x08066777 in rb_gc_mark (ptr=0x4022f65c) at gc.c:634
obj = (RVALUE *) 0x4022f65c
#24 0x08066334 in mark_locations_array (x=0x82b7070, n=5606) at gc.c:378
x = (VALUE *) 0x82b75bc
n = 5606
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 1
#25 0x0805f2e5 in thread_mark (th=0x813f310) at eval.c:7188
th = 0x813f310
frame = (struct FRAME *) 0x4
block = (struct BLOCK *) 0x4
#26 0x08066777 in rb_gc_mark (ptr=0x4022fabc) at gc.c:634
obj = (RVALUE *) 0x4022fabc
#27 0x080667f3 in rb_gc_mark (ptr=0x401cfd34) at gc.c:667
n = 6
vars = (VALUE *) 0x811d85c
obj = (RVALUE *) 0x6
#28 0x0805ce65 in blk_mark (data=0x8100688) at eval.c:6108
data = (struct BLOCK *) 0x8100688
#29 0x08066777 in rb_gc_mark (ptr=0x401c1ce8) at gc.c:634
obj = (RVALUE *) 0x401c1ce8
#30 0x08066386 in mark_entry (key=8893, value=1075584232) at gc.c:405
No locals.
#31 0x0809cbe9 in st_foreach (table=0x80d8888, func=0x8066378 <mark_entry>,
arg=0x0) at st.c:488
table = (st_table *) 0x80d8888
ptr = (st_table_entry *) 0x8100738
last = (st_table_entry *) 0x0
tmp = (st_table_entry *) 0xbfff8e70
retval = ST_CONTINUE
i = 5
#32 0x080663a7 in rb_mark_tbl (tbl=0x80d8888) at gc.c:414
tbl = (st_table *) 0x0
#33 0x0806678b in rb_gc_mark (ptr=0x401cfd20) at gc.c:638
obj = (RVALUE *) 0x401cfd20
#34 0x08066386 in mark_entry (key=2841, value=1075641632) at gc.c:405
No locals.
#35 0x0809cbe9 in st_foreach (table=0x80d8b48, func=0x8066378 <mark_entry>,
arg=0x0) at st.c:488
table = (st_table *) 0x80d8b48
ptr = (st_table_entry *) 0x80d8bd8
last = (st_table_entry *) 0x0
tmp = (st_table_entry *) 0x2b
retval = ST_CONTINUE
i = 3
#36 0x080663a7 in rb_mark_tbl (tbl=0x80d8b48) at gc.c:414
tbl = (st_table *) 0x0
#37 0x0806678b in rb_gc_mark (ptr=0x401cfce4) at gc.c:638
obj = (RVALUE *) 0x401cfce4
#38 0x08066707 in rb_gc_mark (ptr=0x401cfcd0) at gc.c:606
obj = (RVALUE *) 0x401cfcd0
#39 0x08066707 in rb_gc_mark (ptr=0x401cfcbc) at gc.c:606
obj = (RVALUE *) 0x401cfcbc
#40 0x080666db in rb_gc_mark (ptr=0x401cfcf8) at gc.c:601
obj = (RVALUE *) 0x401cfcf8
#41 0x080666db in rb_gc_mark (ptr=0x401c7544) at gc.c:601
obj = (RVALUE *) 0x401c7544
#42 0x080666db in rb_gc_mark (ptr=0x401c7558) at gc.c:601
obj = (RVALUE *) 0x401c7558
#43 0x080666db in rb_gc_mark (ptr=0x401bcf7c) at gc.c:601
obj = (RVALUE *) 0x401bcf7c
#44 0x08066334 in mark_locations_array (x=0xbfffa6f0, n=0) at gc.c:378
x = (VALUE *) 0xbfffa6f0
n = 0
p = (RVALUE *) 0x0
heap_org = (RVALUE *) 0x0
i = 0
#45 0x08066cf1 in rb_gc_mark_frame (frame=0xbfffa630) at gc.c:912
frame = (struct FRAME *) 0xbfffa630
#46 0x08066d88 in rb_gc () at gc.c:988
list = (struct gc_list *) 0x2856
frame = (struct FRAME *) 0xbfffa630
save_regs_gc_mark = {{__jmpbuf = {137024000, 80, 1075412896,
1074707334, 137023632, 33554432}, __mask_was_saved = 137910144,
__saved_mask = {__val = {0, 137910144, 440, 0, 135291808, 135291792, 0,
135291776, 135291760, 135291744, 135291728, 135291712, 3221201760,
3221197280, 3221197280, 3221197280, 128, 1, 136633902, 2, 136623576,
1, 135290396, 135290396, 6094, 4232, 0, 3221202008, 134831526,
135290320, 136623576, 10326}}}}
stack_end = (VALUE *) 0xbfffa438
#47 0x0806623c in rb_newobj () at gc.c:324
No locals.
#48 0x0809ccb8 in rb_str_new (
ptr=0x824cd7d ’ ’ <repeats 12 times>, “<TD
class="tableContentMain">\r\n\r\n\r\n\r\n”, ’ ’
<repeats 12 times>, “\r\n”, ’ ’ <repeats 12 times>, “\r\n”, ’ ’ <repeats 13

, “
\r\n”, ’ ’ <repeats 12 times>,

\r\n”, ’ ’ <repeats 14 times>, “\r\n”, ’ ’ <repeats 16
, “\r”…, len=41) at string.c:39
ptr = 0x824cd7d ’ ’ <repeats 12 times>, “<TD
class="tableContentMain">\r\n\r\n\r\n\r\n”, ’ ’
<repeats 12 times>, “\r\n”, ’ ’ <repeats 12 times>, “\r\n”, ’ ’ <repeats 13
, “
\r\n”, ’ ’ <repeats 12 times>,
\r\n”, ’ ’ <repeats 14 times>, “\r\n”, ’ ’ <repeats 16
, “\r”…
len = 41
str = (struct RString *) 0x2856
#49 0x0809d889 in rb_str_substr (str=1075652036, beg=6053, len=41)
at string.c:360
str = 1075652036
beg = 0
len = 41
str2 = 10326
#50 0x080a0aae in rb_str_split_m (argc=1, argv=0xbfffa6f0, str=1075652036)
at string.c:2253
start = 6053
idx = 1
last_null = 0
regs = (struct re_registers ) 0x819c150
argc = 1
spat = 1075564412
limit = 4
char_sep = -1
beg = 6053
end = 41
i = 0
lim = 0
result = 1075453952
tmp = 0
#51 0x080594ae in call_cfunc (func=0x80a07a0 <rb_str_split_m>,
recv=1075652036, len=-1, argc=1, argv=0xbfffa6f0) at eval.c:4257
func = (VALUE (
)()) 0x80a07a0 <rb_str_split_m>
recv = 1075652036
len = 41
argc = 1
argv = (VALUE *) 0x0
#52 0x08059861 in rb_call0 (klass=1075633332, recv=1075652036, id=4145,
argc=1, argv=0xbfffa6f0, body=0x401cd5ac, nosuper=1) at eval.c:4394
_frame = {self = 1075652036, argc = 1, argv = 0xbfffa6f0,
last_func = 4145, last_class = 0, cbase = 1075584272, prev = 0xbfffb8a0,
tmp = 0x0, file = 0x8100fc0 “dma1”, line = 160, iter = 0, flags = 0}
_iter = {iter = 0, prev = 0xbfffb7c8}
b2 = (NODE *) 0x401aed3c
result = 4
itr = -1073764624
tick = 424221
#53 0x0805a021 in rb_call (klass=1075633332, recv=1075652036, mid=4145,
argc=1, argv=0xbfffa6f0, scope=0) at eval.c:4614
mid = 4145
scope = 0
body = (NODE *) 0x401cd5ac
noex = 1
id = 4145
#54 0x08055490 in rb_eval (self=1075637472, n=0x401bcf40) at eval.c:2544
n = (NODE *) 0x0
node = (NODE *) 0x401bcf40
state = 0
result = 4
#55 0x08055e0d in rb_eval (self=1075637472, n=0x401bcf2c) at eval.c:2700
n = (NODE *) 0x0
node = (NODE *) 0x401bcfa4
state = 0
result = 4
#56 0x08053ba5 in rb_eval (self=1075637472, n=0x401bdcc4) at eval.c:2025
n = (NODE *) 0x0
node = (NODE *) 0x401bcf18
state = 0
result = 4
#57 0x08057fa1 in rb_yield_0 (val=4, self=1075637472, klass=0, acheck=0)
at eval.c:3622
_tag = {buf = {{__jmpbuf = {0, 0, -1073760048, -1073759992,
-1073760352, 134577961}, __mask_was_saved = 0, __saved_mask = {
__val = {3221208904, 4294967295, 608, 0, 3221208920, 3201, 0,
3221207096, 134583507, 1075987356, 2435342, 0, 0, 0, 1073816024,
135386248, 3221207568, 3097, 0, 3221207464, 134584417, 134700528,
1075987356, 1, 1, 3221207568, 1074250064, 3221207176, 134583507,
0,
0, 1075946216}}}}, frame = 0xbfffb8a0, iter = 0xbfffb7c8, tag = 0,
retval = 1075713796, scope = 0x4022dac8, dst = 0, prev = 0xbfffc310}
_iter = {iter = 0, prev = 0xbfffb998}
_class = 1075641632
_old = (struct RVarmap *) 0x0
klass = 0
node = (NODE *) 0x401bdcc4
result = 4
old_cref = 1075584272
old_wrapper = 0
block = (struct BLOCK *) 0xbfffc2a0
old_scope = (struct SCOPE ) 0x4022dac8
frame = {self = 1075637472, argc = 1, argv = 0xbfffc65c,
last_func = 9265, last_class = 1075641632, cbase = 1075584272,
prev = 0xbfffba70, tmp = 0x0, file = 0x8100fc0 “dma1”, line = 136, iter =
0,
flags = 0}
file = 0x8100fc0 “dma1”
line = 136
state = 0
serial = 1340
#58 0x08058205 in rb_f_loop () at eval.c:3717
No locals.
#59 0x080594d3 in call_cfunc (func=0x80581f0 <rb_f_loop>, recv=1075637472,
len=0, argc=0, argv=0x0) at eval.c:4269
func = (VALUE (
)()) 0x80581f0 <rb_f_loop>
recv = 1075637472
len = 41
argc = 0
argv = (VALUE *) 0x0
#60 0x08059861 in rb_call0 (klass=1075641492, recv=1075637472, id=3681,
argc=0, argv=0x0, body=0x401ce538, nosuper=1) at eval.c:4394
_frame = {self = 1075637472, argc = 0, argv = 0x0, last_func = 3681,
last_class = 0, cbase = 1075584272, prev = 0xbfffc760, tmp = 0x0,
file = 0x8100fc0 “dma1”, line = 136, iter = 2, flags = 0}
_iter = {iter = 2, prev = 0xbfffc160}
b2 = (NODE *) 0x0
result = 4
itr = 0
tick = 424221
#61 0x0805a021 in rb_call (klass=1075641492, recv=1075637472, mid=3681,
argc=0, argv=0x0, scope=1) at eval.c:4614
mid = 3681
scope = 1
body = (NODE *) 0x401ce538
noex = 3
id = 3681
#62 0x08055490 in rb_eval (self=1075637472, n=0x401b7324) at eval.c:2544
n = (NODE *) 0x0
node = (NODE *) 0x401b7324
state = 4
result = 4
#63 0x0805453c in rb_eval (self=1075637472, n=0x401bdea4) at eval.c:2276
_iter = {iter = 1, prev = 0xbfffc688}
_block = {var = 0x0, body = 0x401bdcc4, self = 1075637472, frame = {
self = 1075637472, argc = 1, argv = 0xbfffc65c, last_func = 9265,
last_class = 1075641632, cbase = 1075584272, prev = 0xbfffceb0, tmp =
0x0,
file = 0x8100fc0 “dma1”, line = 136, iter = 0, flags = 0},
scope = 0x4022dac8, tag = 0x4022da50, klass = 1075641632, iter = 0,
vmode = 0, flags = 1, dyna_vars = 0x0, orig_thread = 3221209992,
wrapper = 0, prev = 0x0}
_tag = {buf = {{__jmpbuf = {1, -1073756272, -1073757476, -1073756616,
-1073758032, 134563053}, __mask_was_saved = 0, __saved_mask = {
__val = {1075108682, 135495680, 1075421964, 3221209960, 1074707334,
135495680, 36, 0, 3221209824, 1, 1076033656, 1028335257,
1075421964,
4096, 1075412896, 3221209992, 1074722436, 4096, 32, 135491080, 22,
0, 3221212712, 1075412896, 1075421964, 1075412896, 1075412896,
3221210040, 1074706896, 1075410976, 1075421964, 96}}}},
frame = 0xbfffc760, iter = 0xbfffc688, tag = 4294967295, retval = 4,
scope = 0x4022dac8, dst = 0, prev = 0xbfffc6a0}
n = (NODE *) 0x0
node = (NODE *) 0x401b7338
state = 0
result = 4
#64 0x08059c7b in rb_call0 (klass=1075641632, recv=1075637472, id=9265,
argc=0, argv=0xbfffc824, body=0x401bdea4, nosuper=0) at eval.c:4521
_tag = {buf = {{__jmpbuf = {1076028716, 9265, 1, -1073756232,
-1073756608, 134584922}, __mask_was_saved = 0, __saved_mask = {
__val = {0, 0, 135271008, 3221210872, 134634967, 8, 135271000,
135272904, 1, 0, 0, 0, 3221212712, 135474184, 135271008,
3221210920,
134898239, 135474184, 135271000, 8, 135271008, 881934, 1075441672,
0, 135310032, 135272904, 1076033656, 3221210968, 134659348,
135271000, 135272904, 3221210968}}}}, frame = 0xbfffc760,
iter = 0xbfffc688, tag = 4294967295, retval = 4, scope = 0x4022dac8,
dst = 0, prev = 0xbfffcde0}
_old = (struct RVarmap *) 0x4022dadc
_vmode = 0
_old = (struct SCOPE *) 0x401cfd34
_scope = (struct SCOPE *) 0x0
state = 0
local_vars = (VALUE *) 0xbfffc654
saved_cref = (NODE *) 0x401c1d10
_frame = {self = 1075637472, argc = 1, argv = 0xbfffc65c,
last_func = 9265, last_class = 1075641632, cbase = 1075584272,
prev = 0xbfffceb0, tmp = 0x0, file = 0x8100fc0 “dma1”, line = 333, iter =
0,
flags = 0}
_iter = {iter = 0, prev = 0xbfffcdd8}
b2 = (NODE *) 0x401b72d4
result = 4
itr = 1
tick = 424221
#65 0x0805a021 in rb_call (klass=1075641632, recv=1075637472, mid=9265,
argc=1, argv=0xbfffc820, scope=1) at eval.c:4614
mid = 9265
scope = 1
body = (NODE *) 0x4022e52c
noex = 2
id = 9265
#66 0x08055490 in rb_eval (self=1075637472, n=0x401b7090) at eval.c:2544
n = (NODE *) 0x0
node = (NODE *) 0x401b70a4
state = 0
result = 4
#67 0x08057fa1 in rb_yield_0 (val=3, self=1075637472, klass=0, acheck=2)
at eval.c:3622
_tag = {buf = {{__jmpbuf = {0, 135496404, 0, -1073754344, -1073754704,
134577961}, __mask_was_saved = 0, __saved_mask = {__val =
{134578081,
1075637472, 1075580772, 1076033716, 0, 3221212624, 134574852,
1075641632, 35, 135270336, 1075580772, 0, 3221213176, 0, 0,
3221212976, 3221213032, 3221212672, 134577961, 0, 1074710650, 4,
2,
3221212808, 5, 16, 24, 1075412896, 1074707334, 1075412896,
1075412896, 3221212824}}}}, frame = 0xbfffceb0, iter = 0xbfffcdd8,
tag = 0, retval = 4, scope = 0x401cfd34, dst = 0, prev = 0xbfffcf70}
_iter = {iter = 0, prev = 0xbfffd148}
_class = 1075641632
_old = (struct RVarmap *) 0x4022dca8
klass = 0
node = (NODE *) 0x401b7090
result = 4
old_cref = 1075584272
old_wrapper = 0
block = (struct BLOCK *) 0x8138298
old_scope = (struct SCOPE *) 0x401cfd34
frame = {self = 1075637472, argc = 0, argv = 0x0, last_func = 0,
last_class = 0, cbase = 1075584272, prev = 0xbfffd220, tmp = 0x0,
file = 0x8100fc0 “dma1”, line = 333, iter = 0, flags = 0}
file = 0x8100fc0 “dma1”
line = 333
state = 0
serial = 1340
#68 0x0806153f in rb_thread_yield (arg=1076026116, th=0x8137fe0) at
eval.c:8452
arg = 1076026116
#69 0x080612f5 in rb_thread_start_0 (fn=0x8061514 <rb_thread_yield>,
arg=0x4022db04, th_arg=0x8137fe0) at eval.c:8385
_tag = {buf = {{__jmpbuf = {0, 1, 134616492, -1073753928, -1073754288,
134615722}, __mask_was_saved = 0, __saved_mask = {__val =
{134556388,
1075641632, 5637, 0, 3221213568, 6761, 0, 3221214520, 134569970,
9249, 3221216524, 3221214536, 134570043, 1075584272, 5637,
1075637472, 3221216524, 0, 1, 3221213192, 1074707334, 4294967295,
2838798, 0, 3221216456, 0, 1075964656, 2, 3221215168, 3337, 0,
3221213560}}}}, frame = 0xbfffd220, iter = 0xbfffd148,
tag = 4294967294, retval = 4, scope = 0x401cfd34, dst = 0, prev =
0xbfffdd40}
th_arg = 0x0
th = 0x8137fe0
thread = 1076026296
saved_block = (struct BLOCK ) 0x8138298
status = THREAD_RUNNABLE
state = 0
#70 0x080615ec in rb_thread_initialize (thread=1076026296, args=1076026116)
at eval.c:8481
No locals.
#71 0x080594d3 in call_cfunc (func=0x80615ac <rb_thread_initialize>,
recv=1076026296, len=-2, argc=1, argv=0xbfffd550) at eval.c:4269
func = (VALUE (
)()) 0x80615ac <rb_thread_initialize>
recv = 1076026296
len = 41
argc = 1
argv = (VALUE *) 0x0
#72 0x08059861 in rb_call0 (klass=1075620672, recv=1076026296, id=2857,
argc=1, argv=0xbfffd550, body=0x401caaf0, nosuper=1) at eval.c:4394
_frame = {self = 1076026296, argc = 1, argv = 0xbfffd550,
last_func = 2857, last_class = 0, cbase = 1075584272, prev = 0xbfffd490,
tmp = 0x0, file = 0x8100fc0 “dma1”, line = 333, iter = 2, flags = 0}
_iter = {iter = 2, prev = 0xbfffd300}
b2 = (NODE *) 0x401ce538
result = 4
itr = -1073752752
tick = 424221
#73 0x0805a021 in rb_call (klass=1075620672, recv=1076026296, mid=2857,
argc=1, argv=0xbfffd550, scope=1) at eval.c:4614
mid = 2857
scope = 1
body = (NODE *) 0x401caaf0
noex = 3
id = 2857
#74 0x0805a2a9 in rb_funcall2 (recv=1076026296, mid=2857, argc=1,
argv=0xbfffd550) at eval.c:4698
recv = 0
#75 0x0805c237 in rb_obj_call_init (obj=1076026296, argc=1, argv=0xbfffd550)
at eval.c:5717
argc = 1
argv = (VALUE *) 0xbfffd550
_iter = {iter = 1, prev = 0xbfffd3b8}
#76 0x0806156d in rb_thread_s_new (argc=1, argv=0xbfffd550,
klass=1075620672)
at eval.c:8465
argc = 1
argv = (VALUE ) 0xbfffd550
th = 0x8137fe0
#77 0x080594ae in call_cfunc (func=0x8061544 <rb_thread_s_new>,
recv=1075620672, len=-1, argc=1, argv=0xbfffd550) at eval.c:4257
func = (VALUE (
)()) 0x8061544 <rb_thread_s_new>
recv = 1075620672
len = 41
argc = 1
argv = (VALUE *) 0x0
#78 0x08059861 in rb_call0 (klass=1075620652, recv=1075620672, id=3169,
argc=1, argv=0xbfffd550, body=0x401cab18, nosuper=1) at eval.c:4394
_frame = {self = 1075620672, argc = 1, argv = 0xbfffd550,
last_func = 3169, last_class = 0, cbase = 1075584272, prev = 0xbfffe710,
tmp = 0x0, file = 0x8100fc0 “dma1”, line = 333, iter = 2, flags = 0}
_iter = {iter = 2, prev = 0xbfffdb90}
b2 = (NODE *) 0xbfffd400
result = 4
itr = -1073752752
tick = 424221
#79 0x0805a021 in rb_call (klass=1075620652, recv=1075620672, mid=3169,
argc=1, argv=0xbfffd550, scope=0) at eval.c:4614
mid = 3169
scope = 0
body = (NODE *) 0x401cab18
noex = 1
id = 3169
#80 0x08055490 in rb_eval (self=1075637472, n=0x401b7108) at eval.c:2544
n = (NODE *) 0x0
node = (NODE *) 0x401b7108
state = 0
result = 4
#81 0x0805453c in rb_eval (self=1075637472, n=0x401b707c) at eval.c:2276
_iter = {iter = 1, prev = 0xbfffe120}
_block = {var = 0x401b70e0, body = 0x401b7090, self = 1075637472,
frame = {self = 1075637472, argc = 0, argv = 0x0, last_func = 0,
last_class = 0, cbase = 1075584272, prev = 0xbfffe910, tmp = 0x0,
file = 0x8100fc0 “dma1”, line = 333, iter = 0, flags = 0},
scope = 0x401cfd34, tag = 0x4022dc30, klass = 1075641632, iter = 0,
vmode = 0, flags = 1, dyna_vars = 0x4022dca8, orig_thread = 3221216584,
wrapper = 0, prev = 0x0}
_tag = {buf = {{__jmpbuf = {1075540072, -1073748160, -1073750772,
-1073749912, -1073751328, 134563053}, __mask_was_saved = 0,
__saved_mask = {__val = {1074707334, 0, 0, 0, 3221216672, 3221216456,
0,
4, 1075641652, 0, 3221216864, 0, 4096, 26, 67108864, 135487624, 0,
1075637472, 0, 0, 0, 0, 1075584272, 3221217552, 0, 135270336, 46,
0,
0, 7300, 134616492, 3221216776}}}}, frame = 0xbfffe710,
iter = 0xbfffe120, tag = 4294967295, retval = 4, scope = 0x401cfd34,
dst = 0, prev = 0xbfffe640}
n = (NODE *) 0x0
node = (NODE *) 0x401b707c
state = 0
result = 4
#82 0x0805509a in rb_eval (self=1075637472, n=0x401b7054) at eval.c:2523
file = 0x8100fc0 “dma1”
line = 333
i = 1
n = (NODE *) 0x401b7068
_iter = {iter = 0, prev = 0xbfffe638}
tmp_block = (struct BLOCK *) 0x0
recv = 1076028736
argc = 2
argv = (VALUE *) 0xbfffe080
n = (NODE *) 0x0
node = (NODE *) 0x401b7158
state = 0
result = 4
#83 0x08057fa1 in rb_yield_0 (val=3, self=1075637472, klass=0, acheck=0)
at eval.c:3622
_tag = {buf = {{__jmpbuf = {0, -1073745540, 0, -1073748104,
-1073748464, 134577961}, __mask_was_saved = 0, __saved_mask = {
__val = {1074707334, 3221222608, 3221219008, 3221218984, 134637275,
131063, 0, 3221218984, 1074707334, 2857, 1073823048, 3221219000,
134858341, 2857, 4, 135489544, 8, 1076034756, 0, 0, 1075613432,
1076028736, 0, 0, 2857, 0, 1075584272, 3221219600, 0, 135270336,
130, 0}}}}, frame = 0xbfffe710, iter = 0xbfffe638, tag = 0,
retval = 4, scope = 0x401cfd34, dst = 0, prev = 0xbffff1b0}
_iter = {iter = 0, prev = 0xbfffe838}
_class = 1075641632
_old = (struct RVarmap *) 0x0
klass = 0
node = (NODE *) 0x401b7054
result = 4
old_cref = 1075584272
old_wrapper = 0
block = (struct BLOCK *) 0xbffff140
old_scope = (struct SCOPE ) 0x401cfd34
frame = {self = 1075637472, argc = 0, argv = 0x0, last_func = 0,
last_class = 0, cbase = 1075584272, prev = 0xbfffe910, tmp = 0x0,
file = 0x8100fc0 “dma1”, line = 332, iter = 0, flags = 0}
file = 0x8100fc0 “dma1”
line = 332
state = 0
serial = 1340
#84 0x080581ec in rb_yield (val=3) at eval.c:3710
No locals.
#85 0x08089d6a in range_each (range=1076028456) at range.c:185
end = 5
i = 2
b = 2
e = 5
#86 0x080594d3 in call_cfunc (func=0x8089cf4 <range_each>, recv=1076028456,
len=0, argc=0, argv=0x0) at eval.c:4269
func = (VALUE (
)()) 0x8089cf4 <range_each>
recv = 1076028456
len = 41
argc = 0
argv = (VALUE *) 0x0
#87 0x08059861 in rb_call0 (klass=1075605532, recv=1076028456, id=3569,
argc=0, argv=0x0, body=0x401c6f18, nosuper=1) at eval.c:4394
_frame = {self = 1076028456, argc = 0, argv = 0x0, last_func = 3569,
last_class = 0, cbase = 1075584272, prev = 0x80c9fe0, tmp = 0x0,
file = 0x8100fc0 “dma1”, line = 332, iter = 2, flags = 0}
_iter = {iter = 2, prev = 0xbffff000}
b2 = (NODE *) 0x47
result = 4
itr = 0
tick = 424221
#88 0x0805a021 in rb_call (klass=1075605532, recv=1076028456, mid=3569,
argc=0, argv=0x0, scope=0) at eval.c:4614
mid = 3569
scope = 0
body = (NODE *) 0x401c6f18
noex = 1
id = 3569
#89 0x08055490 in rb_eval (self=1075637472, n=0x401b71f8) at eval.c:2544
n = (NODE *) 0x0
node = (NODE *) 0x401b71f8
state = 0
result = 4
#90 0x0805453c in rb_eval (self=1075637472, n=0x401b7018) at eval.c:2276
_iter = {iter = 1, prev = 0xbffffa80}
_block = {var = 0x401b71bc, body = 0x401b7054, self = 1075637472,
frame = {self = 1075637472, argc = 0, argv = 0x0, last_func = 0,
last_class = 0, cbase = 1075584272, prev = 0x0, tmp = 0x0,
file = 0x8100fc0 “dma1”, line = 332, iter = 0, flags = 0},
scope = 0x401cfd34, tag = 0x4022e504, klass = 1075641632, iter = 0,
vmode = 0, flags = 1, dyna_vars = 0x0, orig_thread = 3221221832,
wrapper = 0, prev = 0x0}
_tag = {buf = {{__jmpbuf = {0, 135045136, -1073745540, -1073744680,
-1073746096, 134563053}, __mask_was_saved = 0, __saved_mask = {
__val = {134637491, 1075542472, 10, 135381336, 135381333, 0, 56,
1073743934, 1073743288, 1073742360, 1073816024, 6, 1075542352,
3221223864, 20, 3221221960, 134637275, 1075633332, 4294967295, 0,
1075108682, 0, 0, 0, 71, 3221222176, 3221222016, 3221222016,
1075542312, 3221223864, 20, 3221222024}}}}, frame = 0x80c9fe0,
iter = 0xbffffa80, tag = 4294967295, retval = 4, scope = 0x401cfd34,
dst = 0, prev = 0xbffffa90}
n = (NODE *) 0x0
node = (NODE *) 0x401b702c
state = 0
result = 4
#91 0x08053ba5 in rb_eval (self=1075637472, n=0x401c1af4) at eval.c:2025
n = (NODE *) 0x0
node = (NODE *) 0x401b7004
state = 9449
result = 4
#92 0x08051f91 in ruby_run () at eval.c:1189
_iter = {iter = 0, prev = 0x80ca010}
_tag = {buf = {{__jmpbuf = {-1073742876, 2, -1073742876, -1073743016,
-1073743248, 134553460}, __mask_was_saved = 0, __saved_mask = {
__val = {1073910936, 1074264752, 1073910936, 4, 134526504,
1073817708,
24641422, 24641422, 3221224336, 1073817296, 134532389, 1074706745,
24, 1074275536, 1073910936, 1074706714, 3221224244, 1073816768,
1073818560, 29, 3221224252, 1073784033, 1073816768, 1073817296,
128,
3221224272, 1073784033, 1073817708, 1073911688, 1, 0,
1073910936}}}}, frame = 0x80c9fe0, iter = 0x80ca010, tag = 0,
retval = 4, scope = 0x401cfd34, dst = 0, prev = 0x0}
state = 0
ex = 0
tmp = (NODE *) 0x0
#93 0x0805096f in main (argc=2, argv=0xbffffbe4, envp=0xbffffbf0) at
main.c:50
argc = 2
argv = (char **) 0xbffffbe4
#94 0x4008f1c4 in __libc_start_main () from /lib/libc.so.6
No symbol table info available.

“Yukihiro Matsumoto” matz@ruby-lang.org wrote in message
news:1028419730.358000.2347.nullmailer@picachu.netlab.jp…

Hi,

I’ve built a multi-threaded web spider that uses “thread”, “net/http”
and “ncurses”. Occasionally it will segfault, usually down in the net
code. I’m running Red Hat 7.3 with all the latest updates. The
problem seemed to appear after I did an “apt-get dist-upgrade”, but
considering how intermittent it is, it might have been there before.
Help?

···

On Sun, 4 Aug 2002, Brett Williams wrote:

In message “Another Segmentation Fault problem” > on 02/08/04, Matt Lawrence matt@technoronin.com writes:

Show me the code if possible. And output from the following command:

ruby -v
uname -a

matz.

Here’s another bit of information. The program Segfaults much faster on
a Pentium 233MMX than it does on a 1.5GHz Athlon XP. I’ve done a couple
of hardware checks – both doing multiple kernel builds and running
Memtest86 without any problem. Both of these machines are running
RedHat 7.3 with all of the latest updates.

I’m rather confused as to why it would crash FASTER on a much slower
machine. Odd.

Any ideas?

– Matt

Here's another bit of information. The program Segfaults much faster on
a Pentium 233MMX than it does on a 1.5GHz Athlon XP. I've done a couple
of hardware checks -- both doing multiple kernel builds and running
Memtest86 without any problem. Both of these machines are running
RedHat 7.3 with all of the latest updates.

You have a problem with the GC. Try to reduce your script to a few lines,
and invoke manually the GC to try to reproduce the segfault.

Guy Decoux