Project

General

Profile

Actions

Bug #11423

closed

ruby_cleanup does not reset initialized flag

Added by scorpion007 (Alex Budovski) over 9 years ago. Updated over 9 years ago.

Status:
Closed
Assignee:
-
Target version:
-
[ruby-core:70274]

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.


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #13380: [PATCH] Remove unused Init_frozen_strings declarationClosedsorah (Sorah Fukumori)Actions

Updated by scorpion007 (Alex Budovski) over 9 years ago

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.

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • 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.

Actions #3

Updated by nobu (Nobuyoshi Nakada) over 9 years ago

  • Status changed from Open to Closed

Applied in changeset r51511.


vm.c: frozen_strings in rb_vm_t

Updated by normalperson (Eric Wong) over 9 years ago

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

Actions #5

Updated by usa (Usaku NAKAMURA) over 7 years ago

  • Related to Bug #13380: [PATCH] Remove unused Init_frozen_strings declaration added
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0