0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 23:43:09 +01:00
nodejs/test/cctest
Daniel Bevenius 42c14c5c17 src: set thread local env in CreateEnvironment
This commit set the Environment as a thread local when CreateEnvironment
is called which is currently not being done. This would lead to a
segment fault if later node::AtExit is called without specifying the
environment parameter. This specific issue was reported by Electron.

If I recall correctly, back when this was implemented the motivation was
that if embedders have multiple environments per isolate they should be
using the AtExit functions that take an environment. This is not the
case with Electron which only create a single environment (as far as I
know), and if a native module calls AtExit this would lead to the
segment fault.

I was able to reproduce Electron issue and the provided test simulates
it. I was also able to use this patch and verify that it works for the
Electron issue as well.

PR-URL: https://github.com/nodejs/node/pull/18573
Refs: https://github.com/nodejs/node/pull/9163
Refs: https://github.com/electron/electron/issues/11299
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matheus Marchini <matheus@sthima.com>
2018-02-16 07:27:08 +01:00
..
node_module_reg.cc domain: further abstract usage in C++ 2018-01-29 11:37:29 -05:00
node_test_fixture.cc test: introduce SetUpTestCase/TearDownTestCase 2018-02-06 06:50:14 +01:00
node_test_fixture.h test: remove NodeTestFixture from Env constructor 2018-02-06 06:50:33 +01:00
test_aliased_buffer.cc test: remove destructor from node_test_fixture 2018-02-05 06:58:05 +01:00
test_base64.cc
test_environment.cc src: set thread local env in CreateEnvironment 2018-02-16 07:27:08 +01:00
test_inspector_socket_server.cc test: properly tag anonymous namespaces 2018-02-08 18:43:36 -05:00
test_inspector_socket.cc test: remove unused disposed_ variable 2017-12-14 07:19:49 +01:00
test_node_postmortem_metadata.cc test: remove NodeTestFixture from Env constructor 2018-02-06 06:50:33 +01:00
test_url.cc
test_util.cc