Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

inspector: abort when accessing data from a closed session #27641

Open
vmarchaud opened this issue May 10, 2019 · 1 comment

Comments

Projects
None yet
2 participants
@vmarchaud
Copy link

commented May 10, 2019

  • Version: 8.16.0
  • Platform: Ubuntu 19.04 using Snap distribution
  • Subsystem: inspector

Stacktrace:

 1: node::Abort() [/snap/node/2028/bin/node]
 2: node::AsyncWrap::EmitTraceEventAfter() [/snap/node/2028/bin/node]
 3: node::AsyncWrap::MakeCallback(v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/snap/node/2028/bin/node]
 4: 0x902647 [/snap/node/2028/bin/node]
 5: v8_inspector::V8InspectorSessionImpl::sendProtocolResponse(int, std::unique_ptr<v8_inspector::protocol::Serializable, std::default_delete<v8_inspector::protocol::Serializable> >) [/snap/node/2028/bin/node]
 6: v8_inspector::protocol::DispatcherBase::sendResponse(int, v8_inspector::protocol::DispatchResponse const&, std::unique_ptr<v8_inspector::protocol::DictionaryValue, std::default_delete<v8_inspector::protocol::DictionaryValue> >) [/snap/node/2028/bin/node]
 7: v8_inspector::protocol::HeapProfiler::DispatcherImpl::stopSampling(int, std::unique_ptr<v8_inspector::protocol::DictionaryValue, std::default_delete<v8_inspector::protocol::DictionaryValue> >, v8_inspector::protocol::ErrorSupport*) [/snap/node/2028/bin/node]
 8: v8_inspector::protocol::HeapProfiler::DispatcherImpl::dispatch(int, v8_inspector::String16 const&, std::unique_ptr<v8_inspector::protocol::DictionaryValue, std::default_delete<v8_inspector::protocol::DictionaryValue> >) [/snap/node/2028/bin/node]
 9: v8_inspector::protocol::UberDispatcher::dispatch(std::unique_ptr<v8_inspector::protocol::Value, std::default_delete<v8_inspector::protocol::Value> >) [/snap/node/2028/bin/node]
10: v8_inspector::V8InspectorSessionImpl::dispatchProtocolMessage(v8_inspector::StringView const&) [/snap/node/2028/bin/node]
11: 0x90311e [/snap/node/2028/bin/node]
12: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/snap/node/2028/bin/node]
13: 0xaaa517 [/snap/node/2028/bin/node]
14: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [/snap/node/2028/bin/node]
15: 0x1ac2f94842fd
[1]    1348 abort (core dumped)  node session_inspector_abort.js

Snippet:

const inspector = require('inspector')
const session = new inspector.Session()
session.connect()
session.post('HeapProfiler.enable')
// just to keep the event loop running
setInterval(_ => {}, 100)
session.post('HeapProfiler.startSampling', {
  samplingInterval: undefined
})
session.post('HeapProfiler.stopSampling', (err, params) => {
  session.disconnect()
  // if we remove the console.log, it will not abort.
  console.log(params)
})

I suppose that when closing the session, we are cleaning up all the allocation made so the params here doesn't exist anymore. But it also crash if i'm making a copy with const copy = JSON.parse(JSON.stringify(params)).

Note that i'm only able to replicate with node 8.

@vmarchaud

This comment has been minimized.

Copy link
Author

commented May 10, 2019

Note that if i delay the session.disconnect() inside a setImmediate, it doesn't abort.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.