ruby: fix sporadic segfaults during the garbage collection #80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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