Bug #11423 closed
ruby_cleanup does not reset initialized flag
Added by scorpion007 (Alex Budovski) over 9 years ago.
Updated over 9 years ago.
Description
ruby_setup
checks for this static initialized to determine whether to run.
int
ruby_setup ( void )
{
static int initialized = 0 ;
int state ;
if ( initialized )
return 0 ;
initialized = 1 ;
But ruby_cleanup
fails to reset it, causing future initializations to do nothing. This means an embedded app which runs ruby scripts in a setup/run/cleanup cycle will crash the second time.
Actually, the problem is worse than that: I tried making a simple change to have ruby_cleanup
reset the global flag, but it looks like modules never clean up after themselves!
E.g.
void
Init_frozen_strings ( void )
{
assert ( ! frozen_strings );
frozen_strings = st_init_table_with_size ( & fstring_hash_type , 1000 );
}
frozen_strings
never gets reset to NULL
. Which means the second time ruby_setup
is called, this will assert.
Description updated (diff )
Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: WONTFIX, 2.1: WONTFIX, 2.2: WONTFIX
That cycle is not guaranteed until MVM is supported.
Status changed from Open to Closed
Applied in changeset r51511.
vm.c: frozen_strings in rb_vm_t
nobu@ruby-lang.org wrote:
That cycle is not guaranteed until MVM is supported.
Is MVM still on the roadmap? [ruby-core:64626]
I may take another look at cleaning up internals for MVM
Related to Bug #13380 : [PATCH] Remove unused Init_frozen_strings declaration added
Also available in: Atom
PDF
Like 0
Like 0 Like 0 Like 0 Like 0 Like 0