| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This should crash if the Set fails (promises->Set().FromJust()). USE is only for when we don’t care about the result of execution, and should be used sparingly.
Sorry, something went wrong.
|
Why is this patch preferred over #18249 (comment)? Edit: answered on IRC:
|
Sorry, something went wrong.
There was a problem hiding this comment.
If we were to keep a jobs array, we would want to store the promises from getModuleJob to ensure determinism in the order of jobs.
Sorry, something went wrong.
Returns the promises created by link so that they can be awaited to get rid of race conditions while resolving and loading modules.
|
comments above addressed |
Sorry, something went wrong.
Sorry, something went wrong.
Returns the promises created by link so that they can be awaited to get rid of race conditions while resolving and loading modules. PR-URL: nodejs#18394 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
Unfortunately this requires a corresponding change in lib/internal/vm/Module.js, which did not exist when this PR was created... |
Sorry, something went wrong.
| Local<Promise> resolve_promise = resolve_return_value.As<Promise>(); | ||
| obj->resolve_cache_[specifier_std].Reset(env->isolate(), resolve_promise); | ||
|
|
||
| promises->Set(mod_context, specifier, resolve_promise).FromJust(); |
There was a problem hiding this comment.
This line does not set array items (i.e. it does not set promises[0], promises[1], etc.) It sets promises[specifier] i.e. some non-array properties of promises object. So, the array returned from this function is not populated properly and the corresponding await SafePromise.all(promises) does not do what was expected. There should be i instead of specifier, i.e., promises->Set(mod_context, i, resolve_promise).FromJust();, right?
Sorry, something went wrong.
There was a problem hiding this comment.
yea i actually just caught this while testing my changes for vm.Module. i'm kinda sad this pr landed without tests, as it doesn't work. i have another pr incoming anyway, which will fix this, and includes tests that will actually ensure this behavior does what it is supposed to do.
Sorry, something went wrong.
There was a problem hiding this comment.
Should've caught this while reviewing... my bad as well.
Sorry, something went wrong.
|
This lands cleanly, but is causing v9.x to break during compilation. Should it be backported? ../src/module_wrap.cc:154:9: error: unknown type name 'Array'; did you mean 'v8::Array'?
Local<Array> promises = Array::New(isolate,
^~~~~
v8::Array
../deps/v8/include/v8.h:3553:17: note: 'v8::Array' declared here
class V8_EXPORT Array : public Object {
^
../src/module_wrap.cc:154:27: error: use of undeclared identifier 'Array'; did you mean 'v8::Array'?
Local<Array> promises = Array::New(isolate,
^~~~~
v8::Array
../deps/v8/include/v8.h:3553:17: note: 'v8::Array' declared here
class V8_EXPORT Array : public Object {
^
2 errors generated.
make[1]: *** [/Users/mborins/code/node/v9.x/out/Release/obj.target/node_lib/src/module_wrap.o] Error 1
|
Sorry, something went wrong.
|
@MylesBorins These kinds of errors can be fixed by adding using v8::Array to the top of the file. If you want, you can always do that during backporting – it’s completely harmless, the worst thing that can happen is the linter complaining if the list of using statements isn’t alphabetically sorted. |
Sorry, something went wrong.
Returns the promises created by link so that they can be awaited to get rid of race conditions while resolving and loading modules. PR-URL: #18394 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit fixes up some issues in nodejs#18394. * Switch vm.Module internals to use the new link method properly * Fix bug with ModuleWrap::Link * Add tests for ModuleWrap::Link PR-URL: nodejs#18509 Fixes: nodejs#18249 Refs: nodejs#18394 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Returns the promises created by link so that they can be awaited to get rid of race conditions while resolving and loading modules. PR-URL: #18394 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Returns the promises created by link so that they can be awaited to get rid of race conditions while resolving and loading modules. PR-URL: #18394 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
|
Should this be backported to v8.x-staging? If yes please follow the guide and raise a backport PR, if not let me know or add the dont-land-on label. |
Sorry, something went wrong.
Returns the promises created by link so that they can be awaited to get rid of race conditions while resolving and loading modules. PR-URL: nodejs#18394 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
This commit fixes up some issues in nodejs#18394. * Switch vm.Module internals to use the new link method properly * Fix bug with ModuleWrap::Link * Add tests for ModuleWrap::Link PR-URL: nodejs#18509 Fixes: nodejs#18249 Refs: nodejs#18394 Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
| Back | FazBrowse Home | New Git URL |
Returns the promises created by link so that they can be awaited to get
rid of race conditions while resolving and loading modules.
closes #18249
Checklist
Affected core subsystem(s)
loader, src