Closed tcf909 closed 3 years ago
This is not a segfault it is an assertion failure in libuv. That's a huge difference.
uWS.App().listen(new SharedArrayBuffer(1024), () => {}) Uncaught 'Text and data can only be passed by String, ArrayBuffer or TypedArray.'
It works like it should, you are simply not handling exceptions properly
I was going to mention this earlier but the open handles error in this issue is caused by the same thing as this other issue https://github.com/uNetworking/uWebSockets.js/issues/465 where an uncaught JS error causes the worker thread to exit, and uWS still has uv loop handlers open. But the underlying JS error Text and data can only be passed by String, ArrayBuffer or TypedArray
looks like can be fixed by updating this uWS.js file Utilities.h and add this type check: isSharedArrayBuffer(value)
Perfect. I really appreciate the guidance. It is exactly what I needed.
Hello,
When trying to pass a raw SharedArrayBuffer to ws.send() I get a segfault. I see the API doesn't support this exact class. To work around the issue I wrap the SharedArrayBuffer using new Uint8Array().
I'm not sure what the exact ramifications are in the C code with regard to accepting a SharedArrayBuffer (directly or in disguise). Hoping you can clarify the API and either accept the raw SharedArrayBuffer (like you do the ArrayBuffer), or if this could lead to some really bad issues in the C code, don't accept a typed array backed by a SharedArrayBuffer at all.
I also noticed the segfault error message doesn't convey the issue. I saw you spent some time updating error messages and type checking at some point. Thought this issue would help on that front as well.
Either way, clarification would be appreciated.
Thanks again for the awesome work!