Project

General

Profile

Actions

Bug #2186

closed

Fwd: Segfaults after multiple call of ruby_node_run

Added by yugui (Yuki Sonoda) over 14 years ago. Updated almost 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
*
Backport:
[ruby-core:26016]

Description

=begin
Just forwarding to the redmine so that it recognizes the new issue.

---------- Forwarded message ----------
From: Christoph Kappel
Date: 2009/10/9
Subject: [ruby-core:26012] Segfaults after multiple call of ruby_node_run
To: ruby-core

Hello list,

I am just trying to solve the embedding issue (ruby-core:25927) and
tried to make a small testing program to narrow it down.
Actually I stumbled over another thing which I don't understand, why
does this program segtaults in the second run of the loop:

It's started like this: ./test test.rb

test.c

#include <stdio.h>
#include <unistd.h>
#include <ruby.h>

RUBY_GLOBAL_SETUP

int
main(int argc,
 char *argv[])
{
 void *node = NULL;

 if(2 != argc)
   {
     fprintf(stderr, "Usage: %s \n", argv[0]);
     exit(1);
   }

 ruby_sysinit(&argc, &argv);
 RUBY_INIT_STACK;
 ruby_init();

 node = ruby_options(argc, argv);

 while(1)
   {
     ruby_run_node(node);

     sleep(1);
   }

 rb_exit(0);

 return(0);
}

test.rb

puts "foobar"

--
Yuki Sonoda (Yugui)

http://yugui.jp
=end

Actions #1

Updated by nobu (Nobuyoshi Nakada) over 14 years ago

  • Status changed from Open to Rejected
  • ruby -v set to *

=begin
ruby_run_node() implies ruby_cleanup().
Don't call ruby_cleanup() twice or more.
Use ruby_exec_node() instead.
=end

Actions #2

Updated by unexist (Christoph Kappel) over 14 years ago

=begin
ruby_exec_node() isn't in any of the headers in /usr/include, but it works with an implicit declaration warning of the compiler. Will this function be added in the headers too?
Also a hint in README.EXE about this behaviour with ruby_cleanup() would be nice. In the case I just overread it, my bad.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0