summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--variable.c11
-rw-r--r--version.h2
3 files changed, 18 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 832bfb9f1a..6cdcfd7f78 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/variable.c b/variable.c
index 738494110c..6947dffa2e 100644
--- a/variable.c
+++ b/variable.c
@@ -2020,6 +2020,17 @@ check_autoload_required(VALUE mod, ID id, const char **loadingpath)
if (!RSTRING_PTR(file) || !*RSTRING_PTR(file)) {
rb_raise(rb_eArgError, "empty file name");
}
+
+ /*
+ * if somebody else is autoloading, we MUST wait for them, since
+ * rb_provide_feature can provide a feature before autoload_const_set
+ * completes. We must wait until autoload_const_set finishes in
+ * the other thread.
+ */
+ if (ele->state && ele->state->thread != rb_thread_current()) {
+ return load;
+ }
+
loading = RSTRING_PTR(file);
safe = rb_safe_level();
rb_set_safe_level_force(0);
diff --git a/version.h b/version.h
index c946ff3dd5..7a52ff7c21 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.3.5"
#define RUBY_RELEASE_DATE "2017-06-30"
-#define RUBY_PATCHLEVEL 317
+#define RUBY_PATCHLEVEL 318
#define RUBY_RELEASE_YEAR 2017
#define RUBY_RELEASE_MONTH 6