Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ruby: fix sporadic segfaults during the garbage collection #80

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

asheplyakov
Copy link

rb_sigar_new does not initialize rb_sigar_t->logger, as a result ruby
runtime garbage collection routines sometimes fail either with a segfault
or an assertion failure:

$ cat test2.rb

require 'sigar'
100.times do
GC.disable
sigars = []
100.times do
sigar = Sigar.new
sigars << sigar
end
GC.enable
GC.start
sleep 2
end

$ ruby test2.rb
/home/asheplyakov/tmp/test2.rb:11: [BUG] rb_gc_mark(): unknown data type 0x0(0x7fbff5cc07c8) non object
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
[skipped]

Initialize rb_sigar_t->logger to avoid the problem.

Fixes github issue #79

rb_sigar_new does not initialize rb_sigar_t->logger, as a result ruby
runtime garbage collection routines sometimes fail either with a segfault
or an assertion failure:

$ cat test2.rb

 require 'sigar'
 100.times do
   GC.disable
   sigars = []
   100.times do
     sigar = Sigar.new
     sigars << sigar
   end
   GC.enable
   GC.start
   sleep 2
 end

$ ruby test2.rb
/home/asheplyakov/tmp/test2.rb:11: [BUG] rb_gc_mark(): unknown data type 0x0(0x7fbff5cc07c8) non object
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
[skipped]

Initialize rb_sigar_t->logger to avoid the problem.

Fixes github issue hyperic#79
lizhanyin added a commit to lizhanyin/sigar that referenced this pull request Aug 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant