Project

General

Profile

Actions

Bug #1295

closed

SEGFAULT in RHEL 4

Added by diegosuarez (Diego Suárez García) over 15 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]
Backport:
[ruby-core:22911]

Description

=begin
Hi, I've just registered for reporting a problem I found. I've searched for the bug here, and I think it's not duplicated.
I've got a simple script in ruby which erases files older than 3 hours. I put it in crontab last friday, and today I've read the logs and I see this bug:

/usr/bin/ruby: [BUG] Segmentation fault
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]

-- control frame ----------
c:0002 p:-36764998 s:0004 b:0004 l:000003 d:000003 TOP
c:0001 p:0000 s:0002 b:0002 l:000ccc d:000ccc TOP :17

-- Ruby level backtrace information-----------------------------------------

-- C level backtrace information -------------------------------------------
0x8104657 /usr/bin/ruby(rb_vm_bugreport+0x2b) [0x8104657]

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort

The OS is a RHEL4, update 7. Simply typing ruby reproduces the error. Reinstalling (from source) solved the problem.
=end

Actions #1

Updated by shyouhei (Shyouhei Urabe) over 15 years ago

  • ruby -v changed from - to ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]

=begin
Can you show us that script?

This kind of problems are hard to track without one.
=end

Actions #2

Updated by diegosuarez (Diego Suárez García) over 15 years ago

=begin
Of course, there goes the script:

#!/usr/bin/ruby
require 'fileutils'
require 'date'

if ARGV.length != 2
puts "Uso: borradorSesiones.rb <NUMERO_DE_HORAS>"
exit
end

Dir.foreach(ARGV[0]) do|x|
f = File.new(ARGV[0]+"/"+x)
File.delete(f.path) if f.mtime < (Time.now - (3600*ARGV[1].to_i)) and File.basename(f.path)=~/sess/
end

========
It's almost no more than a one-liner to quick-fix a little problem with a PHP writing too much files. It was in a hourly cron (the order was /path/borradorsesiones.rb /var/path_to_the_dir/ 3)
=end

Actions #3

Updated by shyouhei (Shyouhei Urabe) over 15 years ago

=begin
Hmm, my environment seems not suffering this problem. Your backtrace says line 17 exists on your script, but there are only 13 lines on it. So it seems your ruby binary was broken. How did you install that ruby?
=end

Actions #4

Updated by diegosuarez (Diego Suárez García) over 15 years ago

=begin
I downloaded the stable release from ruby lang. Nothing special, untar the tar.gz, configure, make, make install. All was working fine, even that script, but after the weekend I found a lot of error logs in the cronjob. I tried to run the script manually, I tried to run other scripts, even a ruby -e "puts 'hi'", and no luck, always that error.
The error was gone after reinstalling, but today I examined the logs and it's back. This time I've seen another extra error, here they go both:

===========
^V: compile/should not be reached: compile.c:475
*** glibc detected *** corrupted double-linked list: 0x09bd7e38 ***
Abort

And the other one:

/usr/bin/ruby: [BUG] Segmentation fault
ruby 1.9.1p0 (2009-01-30 revision 21907) [i686-linux]

-- control frame ----------
c:0002 p:-40009030 s:0004 b:0004 l:000003 d:000003 TOP
c:0001 p:0000 s:0002 b:0002 l:0024bc d:0024bc TOP :17

-- Ruby level backtrace information-----------------------------------------

-- C level backtrace information -------------------------------------------
0x8104657 /usr/bin/ruby(rb_vm_bugreport+0x2b) [0x8104657]

[NOTE]
You may encounter a bug of Ruby interpreter. Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html

Abort

Looking carefully the logs, when I first reported the bug I didn't see it, but it was there.
=end

Actions #5

Updated by diegosuarez (Diego Suárez García) over 15 years ago

=begin
Any idea? I've downloaded again the sources and re-installed a few more times, and time after time my installation become corrupted, with the same errors. Is it a Ruby problem, or could be a glibc one?
=end

Actions #6

Updated by oldmoe (Muhammad Ali) over 15 years ago

=begin
How many files do you have in this directory? Seemingly you leave too many files open. Close the file you open in the same loop iteration. As for the segfault, I am not sure but I have seen 1.9.1 segfaulting when dealing with many open fds before.
=end

Actions #7

Updated by diegosuarez (Diego Suárez García) over 15 years ago

=begin
You're right, I completely forgot to close the file. The directory has many many files (~20.000, maybe) so the trouble probably goes that way. I wonder about the segfault anyways, it would be nice to know if there's a limit of open fds at a time.
=end

Actions #8

Updated by yugui (Yuki Sonoda) over 15 years ago

  • Status changed from Open to Closed

=begin

=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0Like0