Repository: node
Issue: Embedding: Creating Multiple Environments
Labels: inspector

### Version

17.4.0

### Platform

Linux

### Subsystem

Inspector

### What steps will reproduce the bug?

Try to initialize more than one evnrionment via:
 std::unique_ptr<CommonEnvironmentSetup> setup = CommonEnvironmentSetup::Create(platform, &errors, args, exec_args);


### How often does it reproduce? Is there a required condition?

Always

### What is the expected behavior?

Two or more environments are correctly initialized

### What do you see instead?

```
/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS[441671]: ../src/inspector_agent.cc:677:bool node::inspector::Agent::Start(const string&, const node::DebugOptions&, std::shared_ptr<node::ExclusiveAccess<node::HostPort> >, bool): Assertion `(start_io_thread_async_initialized.exchange(true)) == (false)' failed.
 1: 0x55d3d21ba434 node::Abort() [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 2: 0x55d3d21ba4c8  [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 3: 0x55d3d21cf85c node::inspector::Agent::Start(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, node::DebugOptions const&, std::shared_ptr<node::ExclusiveAccess<node::HostPort, node::MutexBase<node::LibuvMutexTraits> > >, bool) [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 4: 0x55d3d1fbc409 node::Environment::InitializeInspector(std::unique_ptr<node::inspector::ParentInspectorHandle, std::default_delete<node::inspector::ParentInspectorHandle> >) [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 5: 0x55d3d224205e node::CreateEnvironment(node::IsolateData*, v8::Local<v8::Context>, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, node::EnvironmentFlags::Flags, node::ThreadId, std::unique_ptr<node::InspectorParentHandle, std::default_delete<node::InspectorParentHandle> >) [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 6: 0x55d3d1c56c58 node::CommonEnvironmentSetup::Create<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, node::EnvironmentFlags::Flags>(node::MultiIsolatePlatform*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, node::EnvironmentFlags::Flags&&)::{lambda(node::CommonEnvironmentSetup const*)#1}::operator()(node::CommonEnvironmentSetup const*) const [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 7: 0x55d3d1c5bcce std::_Function_handler<node::Environment* (node::CommonEnvironmentSetup const*), node::CommonEnvironmentSetup::Create<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, node::EnvironmentFlags::Flags>(node::MultiIsolatePlatform*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, node::EnvironmentFlags::Flags&&)::{lambda(node::CommonEnvironmentSetup const*)#1}>::_M_invoke(std::_Any_data const&, node::CommonEnvironmentSetup const*&&) [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 8: 0x55d3d2247295 node::CommonEnvironmentSetup::CommonEnvironmentSetup(node::MultiIsolatePlatform*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, std::function<node::Environment* (node::CommonEnvironmentSetup const*)>) [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
 9: 0x55d3d1c56d75 std::unique_ptr<node::CommonEnvironmentSetup, std::default_delete<node::CommonEnvironmentSetup> > node::CommonEnvironmentSetup::Create<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, node::EnvironmentFlags::Flags>(node::MultiIsolatePlatform*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >*, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >&, node::EnvironmentFlags::Flags&&) [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
10: 0x55d3d1c52bf9 RunNodeInstance(node::MultiIsolatePlatform*) [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
11: 0x55d3d1c531af main [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]
12: 0x7f4b41f680b3 __libc_start_main [/lib/x86_64-linux-gnu/libc.so.6]
13: 0x55d3d1c526ae _start [/tmp/tmp.qZuFIGXaVJ/cmake-nodejs/NodeJS]

```


### Additional information

Is it possible to have two or more environments initialized at the same time for the same process?