From: abudovski@... Date: 2015-08-08T18:48:21+00:00 Subject: [ruby-core:70275] [Ruby trunk - Bug #11423] ruby_cleanup does not reset initialized flag Issue #11423 has been updated by Alex Budovski. 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. ---------------------------------------- Bug #11423: ruby_cleanup does not reset initialized flag https://bugs.ruby-lang.org/issues/11423#change-53698 * Author: Alex Budovski * Status: Open * Priority: Normal * Assignee: * ruby -v: 2.2.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN ---------------------------------------- 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. -- https://bugs.ruby-lang.org/