# Segmentation fault on long running script (linux)

**URL:** <https://www.ruby-forum.com/t/segmentation-fault-on-long-running-script-linux/86839>\
**Category:** Ruby\
**Created:** [February 26, 2007, 11:30am UTC](https://www.ruby-forum.com/t/segmentation-fault-on-long-running-script-linux/86839 "2007-02-26T11:30:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 26, 2007, 11:30am UTC](https://www.ruby-forum.com/t/segmentation-fault-on-long-running-script-linux/86839/1 "2007-02-26T11:30:59Z")

</div>

i have a long running script which takes a lot netcdf files and  
generates SQL which get’s piped to another process for database import.  
the script failed about 1/2 way through (after about 5 days) with  
segmentation fault.

is there a way to debug segfaulting script (i.e. is there a way to  
generate core file) so i can find out more?

my understanding is that segmentation fault is usually caused by  
addressing memory which does not belong to the process (bad pointer and  
such).

## — using ruby 1.8.2 (2005-04-11) [i386-linux]

vlad

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 26, 2007, 4:22pm UTC](https://www.ruby-forum.com/t/segmentation-fault-on-long-running-script-linux/86839/2 "2007-02-26T16:22:01Z")

</div>

On 2/26/07, Vladimir K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> addressing memory which does not belong to the process (bad pointer and  
> such).
> 
> ## — using ruby 1.8.2 (2005-04-11) [i386-linux]
> 
> vlad

I suppose that linux makes core dumps unless it is told not to do  
(using ulimit). You can inspect the core file with gdb. It may be  
helpful to have symbols table available (i.e. not stripped ruby).

Now, don’t take this as too accurate… Last time I debugged a core  
file was in 1999…

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 26, 2007, 4:28pm UTC](https://www.ruby-forum.com/t/segmentation-fault-on-long-running-script-linux/86839/3 "2007-02-26T16:28:01Z")

</div>

On Tue, Feb 27, 2007 at 12:21:08AM +0900, Jan S. wrote:

> I suppose that linux makes core dumps unless it is told not to do  
> (using ulimit).

Or the process is setuid, unless you enable dumping of setuid processes  
with  
sysctl. By default:

kernel.suid\_dumpable = 0

Note that many Linux systems have the core size ulimit set to 0 by  
default.  
I get

$ ulimit -a | grep core  
core file size (blocks, -c) 0

on both Ubuntu 6.06 and CentOS 4.4.

Regards,

Brian.

---

<div class="post-metadata">

**Author:** ![prhlava](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/71e660/32.png) [@prhlava](https://www.ruby-forum.com/u/prhlava)\
**Post date:** [February 26, 2007, 4:42pm UTC](https://www.ruby-forum.com/t/segmentation-fault-on-long-running-script-linux/86839/4 "2007-02-26T16:42:56Z")

</div>

> $ ulimit -a | grep core  
> core file size (blocks, -c) 0

this settings is the “culprit” i think, (this is on debian sarge).

thank you all very much for the pointers.

vlad
