# Timeout, WWW::Mechanize, core dump

**URL:** <https://www.ruby-forum.com/t/timeout-www-mechanize-core-dump/129158>\
**Category:** Ruby\
**Created:** [February 14, 2008, 11:14pm UTC](https://www.ruby-forum.com/t/timeout-www-mechanize-core-dump/129158 "2008-02-14T23:14:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [February 14, 2008, 11:14pm UTC](https://www.ruby-forum.com/t/timeout-www-mechanize-core-dump/129158/1 "2008-02-14T23:14:16Z")

</div>

Hi all,

Solaris 10  
Sun Studio Compiler 12  
ruby 1.8.6 (2007-09-24 patchlevel 111) [sparc-solaris2.10]  
mechanize 0.6.10  
rubygems 0.9.4

$CC =\> cc  
$CFLAGS =\> -g -dalign -fns -xbuiltin=%all -xlibmil -xtarget=ultra2e -  
xO5  
-xipo -xarch=sparc

I’m hitting a core dump with the following program. It works fine when  
I  
run it from the command line, but when run via cron it dumps core.  
Here’s the program in its entirety:

# rf\_downloads.rb

#!/usr/local/bin/ruby  
require ‘rubygems’  
require ‘mechanize’

agent = WWW::Mechanize.new  
body = agent.get(‘[http://rubyforge.org/top/toplist.php](http://rubyforge.org/top/toplist.php)?  
type=downloads’).body

regex = /(._?)\</a\>._?(\d+)/  
file = “Rubyforge\_Downloads\_” + Time.now.strftime(“%d\_%b\_%Y”)  
fh = File.open(file, ‘w’)

 

body.split(“\n”).each{ |line|  
if m = regex.match(line)  
project = m.captures[0].ljust(40)  
downloads = m.captures[1]  
fh.puts “#{project} #{downloads}”  
end  
}

 

fh.close

 
# end rf\_downloads.rb

Here’s the stack info.

djberge-/export/home/djberge/cronjobs-554\>mdb /usr/local/bin/ruby core  
Loading modules: [libc.so.1 ld.so.1]

> ::status  
> debugging core file of rf\_downloads.rb (32-bit) from unknown  
> file: /usr/local/bin/ruby  
> initial argv: /usr/local/bin/ruby  
> /export/home/djberge/cronjobs/rf\_downloads.rb  
> threading model: multi-threaded  
> status: process terminated by SIGABRT (Abort)  
> ::stack  
> libc.so.1`_lwp_kill+8(6, 0, ff1ee450, ff1a4d94, ffffffff, 6) libc.so.1`abort+0x110(2e, 1, 1531c4, aa1a0, ff1ed2d8, 0)  
> rb\_bug+0xc8(137800, 137800, 164bd0, 142c00, 164800, 164800)  
> libc.so.1`__sighndlr+0xc(b, 0, ffbd2160, e91c4, 0, 1) libc.so.1`call\_user\_handler+0x3b8(b, 0, 0, 0, ff0f2000, ffbd2160)  
> libc\_psr.so.1`memcpy+0x1210(a1a700, ffc00030, 14, 0, 30, 9ecb70)  
> rb\_thread\_save\_context+0x1c8(1ad8f0, 0, 9ecb70, 165000, b6f7, b6f7)  
> rb\_thread\_start\_0+0xd0(73578, 96ac20, 6a6f60, 0, 64c00, 73400)  
> rb\_call0+0x80c(19b078, 19b090, 13c1, 13c1, 0, 0)  
> rb\_call+0x404(19b090, f31, 0, 156000, 19afe8, 19b078)  
> rb\_eval+0x1fe0(21fbd0, 220fc8, ffbd8af0, 1a0583f, 340b, ffbd5154)  
> rb\_eval+0xe48(21fbd0, 220db8, 19, 164800, 165000, 156000)  
> rb\_eval+0x3118(21fbd0, 220d88, 0, 156000, 0, 2f)  
> rb\_eval+0x1498(21fbd0, 2210d0, 21fb70, 156000, 2, 164800)  
> rb\_call0+0x10d8(1, ffbd8ac4, 4, 1, 221328, 0)  
> rb\_call+0x404(21fbd0, f31, 2, 156000, 21fb28, 21fae0)  
> rb\_eval+0x1fe0(96bc10, 2206f8, 96ac98, 96ac98, 98, 3)  
> block\_pass+0x198(156000, 220710, 49, 164800, 220710, 156000)  
> rb\_eval+0xc10(96bc10, 2207d0, 1, 156000, 220800, 2)  
> rb\_call0+0x10d8(1, ffbdbfc4, 220830, 4, 220800, 0)  
> rb\_call+0x404(96bc10, f31, 1, 156000, 21fba0, 1)  
> rb\_eval+0x2354(96bc10, 229ab8, ffbdf160, 430583f, 860b, ffbde264)  
> rb\_eval+0xe48(96bc10, 229938, 0, 156000, 229b18, 2f)  
> rb\_call0+0x10d8(0, ffbdf134, 229938, 0, 229b18, 0)  
> rb\_call+0x404(96bc10, f31, 0, 156000, 21f3c0, 2)  
> rb\_eval+0x2388(96bc10, 22a2c8, 0, 156000, 22a298, 22a298)  
> rb\_eval+0xb8c(96bc10, 22a160, 0, 4, 96aed8, ffbe2708)  
> rb\_eval+0x12cc(96bc10, 229ed8, 1, 156000, 22a3b8, 2)  
> rb\_call0+0x10d8(1, ffbe37f4, 22a3d0, 4, 22a3b8, 0)  
> rb\_call+0x404(96bc10, f31, 1, 156000, 21f420, 1)  
> rb\_eval+0x2354(96bc10, 229da0, 0, 0, 156000, ffbe6990)  
> rb\_eval+0x1cd8(96bc10, 229d28, 0, 156000, 229e18, 2f)  
> rb\_call0+0x10d8(0, ffbe6964, 229d28, 0, 229e18, 0)  
> rb\_call+0x404(96bc10, f31, 0, 156000, 21f3f0, 21f6c0)  
> rb\_eval+0x1fe0(22a070, 233718, 19, 164800, 165000, 156000)  
> rb\_eval+0x3118(22a070, 2334f0, ffffffff, 156000, 233778, 2f)  
> rb\_call0+0x10d8(1, ffbe9ae4, 4, 4, 233778, 0)  
> rb\_call+0x404(22a070, f31, 1, 156000, 224580, 1)  
> rb\_eval+0x2354(22a070, 233d18, 46, 164800, 233d00, 0)  
> rb\_eval+0x1128(22a070, 233d00, 18, 164800, 233d60, 233d60)  
> rb\_eval+0x30c8(22a070, 233b98, ffffffff, 156000, 233e20, 2f)  
> rb\_call0+0x10d8(1, ffbee1b4, 4, 4, 233e20, 0)  
> rb\_call+0x404(22a070, f31, 1, 156000, 224718, 229f08)  
> rb\_eval+0x1fe0(96bd30, 24d278, 19, 164800, 165000, 156000)  
> rb\_eval+0x3118(96bd30, 24d260, 156000, 0, ffbf1e20, 2f)  
> rb\_eval+0x9ec(96bd30, 24dad0, 1, 156000, 24db00, 2)  
> rb\_call0+0x10d8(1, ffbf28a4, 24db30, 4, 24db00, 0)  
> rb\_call+0x404(96bd30, f31, 1, 156000, 22f2d8, 2328d8)  
> rb\_eval+0x1fe0(974160, 3e98b0, ffbf6fd0, 1010583f, 2020b, ffbf4b44)  
> rb\_eval+0xe48(974160, 3e4648, 19, 164800, 165000, 156000)  
> rb\_eval+0x3118(974160, 458820, 3, 156000, 3, 164800)  
> rb\_call0+0x10d8(1, ffbf6fa4, 458be0, 2, 458bc8, 0)  
> rb\_call+0x404(974160, f31, 3, 156000, 96c678, 1)  
> rb\_eval+0x2354(974160, 461b68, 153c00, 4, 164800, 0)  
> block\_pass+0x5c(974160, 461b80, ffbfba28, 461b80, 156000, 0)  
> rb\_eval+0xc10(974160, 461b80, 19, 164800, 165000, 156000)  
> rb\_eval+0x3118(974160, 462018, 1, 156000, 462048, 2)  
> rb\_call0+0x10d8(1, ffbfb9fc, 462078, 4, 462048, 0)  
> rb\_call+0x404(974160, f31, 1, 156000, 96c978, 553f98)  
> rb\_eval+0x1fe0(19e330, 18b3b8, 0, 0, 156000, ffbffb88)  
> rb\_eval+0x1cd8(19e330, 18b3a0, 19, 164800, 165000, 156000)  
> rb\_eval+0x3118(19e330, 18b538, ffbffbb8, 156000, 165000, 153c00)  
> ruby\_exec\_internal+0xc0(153c00, 0, 0, 0, ffbffb90, 156000)  
> ruby\_run+0x20(156000, 0, 0, 0, 156000, 0)  
> main+0x20(2, ffbffeac, ffbffeb8, 153800, ff0f00c0, ff0f0100)  
> \_start+0x108(0, 0, 0, 0, 0, 0)

The only thing unusual about my system that I can think of offhand is  
that my hostname is “unknown”.

If there’s any other info I can provide from the core file please let  
me  
know (and also let me know how to get it - I’m not that familiar with  
debugging core files).

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [February 15, 2008, 2:59am UTC](https://www.ruby-forum.com/t/timeout-www-mechanize-core-dump/129158/2 "2008-02-15T02:59:02Z")

</div>

Hi,

At Fri, 15 Feb 2008 07:10:37 +0900,  
Daniel B. wrote in [ruby-talk:291077]:

> I’m hitting a core dump with the following program. It works fine when  
> I  
> run it from the command line, but when run via cron it dumps core.

It seems similar to [ruby-dev:33611], and akr was suggesting  
changing the following in gc.c from 0x80 to 0.

#if defined(sparc) || defined( **sparc** )

# define STACK\_LENGTH (rb\_gc\_stack\_start - STACK\_END + 0x80)

Could you try it?

# Index: gc.c

— gc.c (revision 15479)  
+++ gc.c (working copy)  
@@ -454,7 +454,5 @@ stack\_end\_address(VALUE \*\*stack\_end\_p)

# define STACK\_END (stack\_end)

#endif  
-#if defined(sparc) || defined( **sparc** )  
-# define STACK\_LENGTH (rb\_gc\_stack\_start - STACK\_END + 0x80)  
-#elif STACK\_GROW\_DIRECTION \< 0  
+#if STACK\_GROW\_DIRECTION \< 0

# define STACK\_LENGTH (rb\_gc\_stack\_start - STACK\_END)

#elif STACK\_GROW\_DIRECTION \> 0

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [February 20, 2008, 12:17am UTC](https://www.ruby-forum.com/t/timeout-www-mechanize-core-dump/129158/3 "2008-02-20T00:17:00Z")

</div>

On Feb 14, 6:57 pm, Nobuyoshi N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> — gc.c (revision 15479)  
> +++ gc.c (working copy)  
> @@ -454,7 +454,5 @@ stack\_end\_address(VALUE \*\*stack\_end\_p)
> 
> # define STACK\_END (stack\_end)
> 
> #endif  
> -#if defined(sparc) || defined( **sparc** )  
> -# define STACK\_LENGTH (rb\_gc\_stack\_start - STACK\_END + 0x80)  
> -#elif STACK\_GROW\_DIRECTION \< 0  
> +#if STACK\_GROW\_DIRECTION \< 0
> 
> # define STACK\_LENGTH (rb\_gc\_stack\_start - STACK\_END)
> 
> #elif STACK\_GROW\_DIRECTION \> 0

That worked, thanks!

Dan
