Closed AcidLeroy closed 5 years ago
To add to the comment by @AcidLeroy, calling `net.discovery.destory()' at the wrong time results in the following stack trace for me:
/usr/bin/node[21266]: ../src/node_buffer.cc:210:char* node::Buffer::Data(v8::Local<v8::Value>): Assertion `val->IsArrayBufferView()' failed.
1: node::Abort() [/usr/bin/node]
2: 0x8c25db [/usr/bin/node]
3: node::Buffer::Data(v8::Local<v8::Object>) [/usr/bin/node]
4: napi_get_buffer_info [/usr/bin/node]
5: utp_napi_send(napi_env__*, napi_callback_info__*) [/home/***/node_modules/@hyperswarm/network/node_modules/utp-native/prebuilds/linux-x64/node-napi.node]
6: 0x8d56a5 [/usr/bin/node]
7: v8::internal::FunctionCallbackArguments::Call(void (*)(v8::FunctionCallbackInfo<v8::Value> const&)) [/usr/bin/node]
8: 0xad710c [/usr/bin/node]
9: v8::internal::Builtin_HandleApiCall(int, v8::internal::Object**, v8::internal::Isolate*) [/usr/bin/node]
10: 0x9b1bc1042fd
This happens if I attempt to destroy immediately after leaving the last topic. I also attempted to ensure the @hyperswarm/discovery was completely 'closed' before doing so, given the following:
net._topics.get(key.toString('hex')).on('close', function() {
net.discovery.destroy();
});
But this results in the same stack trace. Only work around so far seems to be a magic setTimeout
(I tried 10 seconds) before destroying.
@nathanestark Thanks for the bug report. That def does not look right.
@nathanestark anyway you can share a full runnable testcase for that?
@mafintosh Sorry about not providing details yet. We're still trying to track down what the exact issue might be. If we can't provide a simple runnable test to demonstrate this, I will close this issue out next week. Thanks!
This may be somewhat of a duplicate of #3, but how does one effectively close connections?
Not sure why this isn't documented, but we were having some issues with the discovery-swarm when calling destroy (segfaults and the like) .