Project

General

Profile

Bug #11423

ruby_cleanup does not reset initialized flag

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

Status:
Closed
Priority:
Normal
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

Related to Ruby trunk - Bug #13380: [PATCH] Remove unused Init_frozen_strings declarationClosedActions

Associated revisions

Revision f7ab0906
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm.c: frozen_strings in rb_vm_t

  • vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51511 b2dd03c8-39d4-4d8f-98ff-823fe69b080e

Revision 51511
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm.c: frozen_strings in rb_vm_t

  • vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423]

Revision 51511
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm.c: frozen_strings in rb_vm_t

  • vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423]

Revision 51511
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm.c: frozen_strings in rb_vm_t

  • vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423]

Revision 51511
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm.c: frozen_strings in rb_vm_t

  • vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423]

Revision 51511
Added by nobu (Nobuyoshi Nakada) over 3 years ago

vm.c: frozen_strings in rb_vm_t

  • vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423]

History

Updated by scorpion007 (Alex Budovski) over 3 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 3 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.

#3

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Open to Closed

Applied in changeset r51511.


vm.c: frozen_strings in rb_vm_t

  • vm.c (Init_vm_objects, rb_vm_fstring_table): use frozen_strings table in rb_vm_t. [ruby-core:70274] [Bug #11423]

Updated by normalperson (Eric Wong) over 3 years ago

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

#5

Updated by usa (Usaku NAKAMURA) almost 2 years ago

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

Also available in: Atom PDF