You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've encountered an issue with the library when using the nightly Rust version in conjunction with the rustflags +atomics,+bulk-memory,+mutable-globals.
Here's the relevant code snippet:
let(mut ws_meta,mut ws_stream) = WsMeta::connect(ws_server_url,None).await.expect_throw("Assumed the client ws connection would succeed");letmut io_stream = ws_stream.into_io();let message = b"Hello from browser".to_vec();
io_stream
.write(&message).await.expect_throw("Failed to write to websocket");
While attempting to write to a websocket (io_stream), the operation fails.
WsMessage::Binary( d ) => self.ws.send_with_u8_array(&d ).map_err( |_| WsErr::ConnectionNotOpen)? ,
If the line is replaced by
WsMessage::Binary(d) => {let buffer = ArrayBuffer::new(
d.len().try_into().expect("Message was too large to be sent."),);Uint8Array::new(&buffer).copy_from(d.as_slice());self.ws.send_with_array_buffer(&buffer).map_err(|_| WsErr::ConnectionNotOpen)?
}
, it works. However, we then encountered a oom issue with our application
I was guessing it is related to memory leaking, for example, buffer is not gc'ed and too many writes may end up using up the memory. But it's just my suspicion and I haven't verified it and may be wrong.
Description
I've encountered an issue with the library when using the nightly Rust version in conjunction with the rustflags
+atomics,+bulk-memory,+mutable-globals
.Here's the relevant code snippet:
While attempting to write to a websocket (io_stream), the operation fails.
Environment
OS: macOS 12.6
cargo: 1.68.0-nightly (70898e522 2022-12-05)
rustc: 1.68.0-nightly (bdb07a8ec 2022-12-11)
Browser: Chrome Version 116.0.5845.140 (Official Build) (x86_64)
Reproduction Steps
For a detailed step-by-step reproduction guide, please refer to this repository.
I'd greatly appreciate any feedback, solutions, or clarifications regarding this issue.
The text was updated successfully, but these errors were encountered: