summaryrefslogtreecommitdiff
path: root/ext/web/message_port.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2024-04-16 00:06:39 +0100
committerGitHub <noreply@github.com>2024-04-16 01:06:39 +0200
commit0b8d7d1d4b068df46a14895b2f55c00781bd1eef (patch)
tree0a478c09731a8f5c15b3eaee5124dadd39631edc /ext/web/message_port.rs
parent46c709e52f712ef7e1e41285ec06e9bbbe10c0a5 (diff)
fix(ext/node): panic on 'worker_threads.receiveMessageOnPort' (#23386)
Closes https://github.com/denoland/deno/issues/23362 Previously we were panicking if there was a pending read on a port and `receiveMessageOnPort` was called. This is now fixed by cancelling the pending read, trying to read a message and resuming reading in a loop.
Diffstat (limited to 'ext/web/message_port.rs')
-rw-r--r--ext/web/message_port.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/ext/web/message_port.rs b/ext/web/message_port.rs
index 1cd29c64d..ac33145b1 100644
--- a/ext/web/message_port.rs
+++ b/ext/web/message_port.rs
@@ -235,6 +235,7 @@ pub fn op_message_port_recv_message_sync(
#[smi] rid: ResourceId,
) -> Result<Option<JsMessageData>, AnyError> {
let resource = state.resource_table.get::<MessagePortResource>(rid)?;
+ resource.cancel.cancel();
let mut rx = resource.port.rx.borrow_mut();
match rx.try_recv() {