1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/ruby
normal ec959fbb4b variable.c: fix multiple autoload with identical file (again)
We need to ensure autoload declarations pointing to the same
feature (aka "file") can wait on each other to avoid deadlock
situations.

So, reorganize autoload data structures to maintain a
feature => autoload_data_i mapping, and have module constant
tables point to the new autoload_const struct instead of
directly to autoload_data_i.  This allows multiple
autoload_const structs to refer to the SAME autoload_data_i
struct, and with it, the on-stack autoload_state.waitq.

The end result is different constants can share the same waitq
(tied to the feature name), and not deadlock each other during
loading.

Thanks to Eugene Kenny for the bug report and reproducible test case.

Reported-by: Eugene Kenny <elkenny@gmail.com>

* variable.c (autoload_featuremap): new global
  (struct autoload_const): new per-const struct
  (struct autoload_state): reference autoload_const instead of autoload_data_i
  (struct autoload_data_i): remove per-const
  (autoload_i_mark): delete from autoload_featuremap if unreferenced
  (autoload_c_mark): new dmark callback
  (autoload_c_free): new dfree callback
  (autoload_c_memsize): new memsize callback
  (autoload_const_type): new data type
  (get_autoload_data): set autoload_const as well
  (rb_autoload_str): use new data structures
  (autoload_delete): cleanup from autoload_featuremap
  (check_autoload_required): adjust for new internals
  (rb_autoloading_value): ditto
  (struct autoload_const_set_args): remove, redundant with autoload_const
  (const_tbl_update): adjust for new internals
  (autoload_const_set): ditto
  (autoload_require): ditto
  (autoload_reset): ditto
  (rb_autoload_load): ditto
  (rb_const_set): ditto
  (current_autoload_data): ditto
  (set_const_visibility): ditto
* test/ruby/test_autoload.rb (test_autoload_same_file): new test
  (test_no_leak): new test
  [ruby-core:86935] [Bug #14742]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63392 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-10 08:54:26 +00:00
..
enc fix unicode data directory 2017-12-23 00:30:33 +00:00
allpairs.rb
beginmainend.rb
bug-11928.rb
bug-13526.rb test/ruby/bug-13526.rb: should wait until all threads are stopped 2017-11-21 00:56:09 +00:00
lbtest.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
marshaltestlib.rb marshaltestlib.rb: use clean object for exception 2018-04-12 03:40:16 +00:00
sentence.rb
test_alias.rb test/ruby: tweaked heredocs 2017-08-29 07:11:52 +00:00
test_argf.rb io.c: encoding of ARGF.inplace_mode 2017-10-10 12:30:42 +00:00
test_arity.rb
test_array.rb Introduce endless range [Feature#12912] 2018-04-19 15:18:50 +00:00
test_assignment.rb Enable the assertions that had been disabled for historical reason 2018-04-17 08:26:20 +00:00
test_autoload.rb variable.c: fix multiple autoload with identical file (again) 2018-05-10 08:54:26 +00:00
test_backtrace.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
test_basicinstructions.rb Remove the old disabled assertions for 1.8/1.9 2018-04-17 08:47:56 +00:00
test_beginendblock.rb test/ruby: tweaked heredocs 2017-08-29 07:11:52 +00:00
test_bignum.rb use Queue for inter-thread synchronization. 2018-04-04 05:00:52 +00:00
test_call.rb test_call.rb: refine test_safe_call 2017-10-02 11:43:36 +00:00
test_case.rb
test_class.rb Add FrozenError as a subclass of RuntimeError 2017-12-12 00:46:34 +00:00
test_clone.rb
test_comparable.rb
test_complex.rb Add exception: keyword in Kernel#Complex() 2018-03-15 07:19:48 +00:00
test_complex2.rb
test_complexrational.rb
test_condition.rb
test_const.rb
test_continuation.rb Fix test-all tests to avoid creating report_on_exception warnings 2017-12-12 18:44:49 +00:00
test_defined.rb defined? returns nil for toplevel constant lookup 2018-01-27 06:12:09 +00:00
test_dir.rb dir.c: warning for NUL 2018-04-19 07:05:39 +00:00
test_dir_m17n.rb High Sierra's APFS cannot use invalid filenames [Bug #13816] 2017-08-15 21:33:43 +00:00
test_econv.rb
test_encoding.rb test/ruby: tweaked heredocs 2017-08-29 07:11:52 +00:00
test_enum.rb Add case equality arity to Enumerable#all?, any?, none? and one?, 2017-12-10 22:36:28 +00:00
test_enumerator.rb test_enumerator.rb: duplicate assertions 2018-03-13 02:43:04 +00:00
test_env.rb Add slice method to ENV like Hash#slice 2018-04-19 05:55:42 +00:00
test_eval.rb Remove the old disabled assertions for 1.8/1.9 2018-04-17 08:47:56 +00:00
test_exception.rb error.c: super in method_missing 2018-04-12 03:48:48 +00:00
test_fiber.rb test_fiber.rb: fix test_create_fiber_in_new_thread 2018-04-03 16:54:27 +00:00
test_file.rb file.c: realpath on special symlink 2018-02-28 05:43:53 +00:00
test_file_exhaustive.rb win32/file.c: relative path with drive letter 2018-03-28 07:01:48 +00:00
test_fixnum.rb
test_flip.rb
test_float.rb object.c: raise on long invalid float string 2018-05-04 06:12:12 +00:00
test_fnmatch.rb Revert "Dir.glob with FNM_EXTGLOB is optimized [Feature #13873]" 2017-10-27 08:40:40 +00:00
test_gc.rb Revert "Revert "Manage AST NODEs out of GC"" 2017-10-27 16:44:57 +00:00
test_hash.rb Add a new #filter alias for #select 2018-02-25 13:52:07 +00:00
test_ifunless.rb Rename test classes to allow stable test count when running test-all -j 2018-03-13 06:29:02 +00:00
test_integer.rb Add exception: keyword in Kernel#Integer() 2018-03-15 07:19:43 +00:00
test_integer_comb.rb Integer#allbits?, Integer#anybits?, Integer#nobits? [Feature #12753] 2017-12-12 09:12:14 +00:00
test_io.rb Remove unreachable break 2018-05-08 00:00:13 +00:00
test_io_m17n.rb trick ruby-mode.el by heredocs 2018-01-31 04:02:17 +00:00
test_iseq.rb compile.c: align range 2018-04-16 12:46:08 +00:00
test_iterator.rb compile.c: try to convert in massign for 2018-01-27 10:41:43 +00:00
test_jit.rb _mjit_compile_send.erb: revert r63350 2018-05-09 17:11:07 +00:00
test_key_error.rb error.c: KeyError missing keyword arguments 2018-01-26 06:41:13 +00:00
test_keyword.rb assertions for r62914 2018-03-25 14:06:06 +00:00
test_lambda.rb
test_lazy_enumerator.rb Bug Fix Enumerator::Lazy#uniq state for multiple call 2018-03-13 01:00:08 +00:00
test_literal.rb parse.y: extra error message after no digits 2018-04-09 11:09:30 +00:00
test_m17n.rb string.c: fix dumped suffix 2018-04-16 07:12:06 +00:00
test_m17n_comb.rb
test_marshal.rb marshal.c: allow marshalling keyword_init struct 2018-01-05 11:44:31 +00:00
test_math.rb
test_metaclass.rb
test_method.rb proc.c: fix segfault when no singleton class 2018-04-03 06:57:44 +00:00
test_mixed_unicode_escapes.rb parse.y (new_regexp): Fix SEGV of /#{"\u3042"}#{'い'}/ in non UTF-8 2018-01-16 01:43:25 +00:00
test_module.rb Remove the disabled old tests for Ruby 1.8/1.9 feature change 2018-04-17 08:18:58 +00:00
test_not.rb Rename test classes to allow stable test count when running test-all -j 2018-03-13 06:29:02 +00:00
test_notimp.rb apply timeout scale 2017-05-27 02:01:41 +00:00
test_numeric.rb test_numeric.rb: loose precision assertion 2018-04-26 00:12:35 +00:00
test_object.rb Add FrozenError as a subclass of RuntimeError 2017-12-12 00:46:34 +00:00
test_objectspace.rb
test_optimization.rb compile.c: fix unconditional branch optimization 2018-04-25 06:45:05 +00:00
test_pack.rb pack.c: fix underflow 2018-03-28 10:12:17 +00:00
test_parse.rb parse.y: fix cmdarg in command_args 2018-04-17 01:22:26 +00:00
test_path.rb
test_pipe.rb win32.c: EPIPE for ERROR_NO_DATA 2018-02-01 02:56:28 +00:00
test_primitive.rb
test_proc.rb extend timeout more 2018-01-18 03:53:46 +00:00
test_process.rb test_process.rb: assert minimum maxgroups 2018-02-22 01:58:29 +00:00
test_rand.rb random.c: Random.bytes 2018-02-20 09:26:38 +00:00
test_range.rb range.c: each on endless range 2018-04-28 07:31:32 +00:00
test_rational.rb bignum.c: Bignum#fdiv avoids double division when divisor is bignum 2018-04-04 14:02:59 +00:00
test_rational2.rb
test_readpartial.rb
test_refinement.rb vm_args.c: to_proc refinements 2018-01-24 06:25:02 +00:00
test_regexp.rb re.c: do not escape terminator in Regexp.union 2018-03-16 13:37:44 +00:00
test_require.rb $SAFE as a process global state. [Feature #14250] 2017-12-28 20:09:24 +00:00
test_rubyoptions.rb Use &. instead of modifier if 2018-05-09 12:51:14 +00:00
test_rubyvm.rb
test_settracefunc.rb The test for TracePoint with thread had never worked correctly 2018-04-17 08:47:58 +00:00
test_signal.rb signal.c: refine error messages 2018-03-10 11:26:54 +00:00
test_sleep.rb
test_sprintf.rb error.c: KeyError#receiver and KeyError#key 2017-09-18 08:05:53 +00:00
test_sprintf_comb.rb
test_string.rb string.c: fix scanned substring with \K 2018-04-24 12:25:46 +00:00
test_stringchar.rb
test_struct.rb struct.c: show keyword_init: true on inspect 2017-12-12 15:03:45 +00:00
test_super.rb test/ruby/test_super.rb: Remove unused assertions 2018-04-17 08:52:25 +00:00
test_symbol.rb Suppress warning: method redefined; discarding old == 2017-07-03 08:08:29 +00:00
test_syntax.rb parse.y: terminator at continued line 2018-03-21 12:40:16 +00:00
test_system.rb process.c: command_name encoding 2018-02-03 03:50:28 +00:00
test_thread.rb thread.c: reset waitq of keeping mutexes in child 2018-03-05 22:58:13 +00:00
test_threadgroup.rb Remove unnecessary require 'thread' 2017-10-08 07:00:01 +00:00
test_time.rb skip a test if another Thread is running. 2018-02-28 07:31:49 +00:00
test_time_tz.rb test_time_tz.rb: Lisbon tzdata fix 2018-04-01 13:16:14 +00:00
test_trace.rb test_exception.rb: test_machine_stackoverflow_by_trace 2017-05-10 06:38:30 +00:00
test_transcode.rb Add FrozenError as a subclass of RuntimeError 2017-12-12 00:46:34 +00:00
test_undef.rb
test_unicode_escape.rb
test_variable.rb Add FrozenError as a subclass of RuntimeError 2017-12-12 00:46:34 +00:00
test_vm_dump.rb test_vm_dump.rb: skip if gcc 2017-12-16 00:36:31 +00:00
test_weakmap.rb test_weakmap.rb: skip unstable assertion 2018-03-16 14:12:39 +00:00
test_whileuntil.rb
test_yield.rb
ut_eof.rb