diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-30 10:56:33 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-06-30 10:56:33 +0000 |
commit | e9ce3e744dca3911153ba97b89cba7e7e20b8a5d (patch) | |
tree | f229afe8f8ab58447a73bf1e5da6ef8810c5e3f2 /ChangeLog | |
parent | d4f03fab29b08a11f5ced7087785a20296971283 (diff) |
merge revision(s) 58696: [Backport #11384]
autoload: always wait on loading thread
We cannot assume autoload_provided/rb_feature_provided returning
TRUE means it is safe to proceed without waiting. Another
thread may call rb_provide_feature before setting the constant
(via autoload_const_set). So we must wait until autoload is
completed by another thread.
Note: this patch was tested with an explicit rb_thread_schedule
in rb_provide_feature to make the race condition more apparent
as suggested by <s.wanabe@gmail.com>:
> --- a/load.c
> +++ b/load.c
> @@ -563,6 +563,7 @@ rb_provide_feature(VALUE feature)
> rb_str_freeze(feature);
>
> rb_ary_push(features, rb_fstring(feature));
> +rb_thread_schedule();
> features_index_add(feature, INT2FIX(RARRAY_LEN(features)-1));
> reset_loaded_features_snapshot();
> }
* variable.c (check_autoload_required): do not assume a provided
feature means autoload is complete, always wait if autoload is
being performed by another thread.
[ruby-core:81105] [Bug #11384] Thanks to <s.wanabe@gmail.com>
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@59221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ChangeLog')
-rw-r--r-- | ChangeLog | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -1,3 +1,9 @@ +Fri Jun 30 19:56:06 2017 Eric Wong <e@80x24.org> + + * variable.c (check_autoload_required): do not assume a provided feature + means autoload is complete, always wait if autoload is being performed + by another thread. [Bug #11384] Thanks to s.wanabe@gmail.com + Fri Jun 30 19:53:30 2017 Nobuyoshi Nakada <nobu@ruby-lang.org> * process.c (obj2uid, obj2gid): use temporary string as the buffer |