0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-30 09:08:00 -04:00
denoland-deno/cli/tests/integration
Andreu Botella b7c2902c97
Don't drop messages from workers that have already been closed (#11913)
When `worker.terminate()` is called, the spec requires that the
corresponding port message queue is emptied, so no messages can be
received after the call, even if they were sent from the worker before
it was terminated.

The spec doesn't require this of `self.close()`, and since Deno uses
different channels to send messages and to notify that the worker was
closed, messages might still arrive after the worker is known to be
closed, which are currently being dropped. This change fixes that.

The fix involves two parts: one on the JS side and one on the Rust side.
The JS side was using the `#terminated` flag to keep track of whether
the worker is known to be closed, without distinguishing whether further
messages should be dropped or not. This PR changes that flag to an
enum `#state`, which can be one of `"RUNNING"`, `"CLOSED"` or
`"TERMINATED"`.

The Rust side was removing the `WorkerThread` struct from the workers
table when a close control was received, regardless of whether there
were any messages left to read, which made any subsequent calls to
`op_host_recv_message` to return `Ok(None)`, as if there were no more
mesasges. This change instead waits for both a close control and for
the message channel's sender to be closed before the worker thread is
removed from the table.
2021-09-06 11:05:02 +02:00
..
bundle_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
cache_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
compile_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
coverage_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
doc_tests.rs fix(cli): deno doc panics on invalid url (#11536) 2021-07-29 04:07:25 -07:00
eval_tests.rs chore: split up integration_tests.rs into separate files (#11131) 2021-06-27 13:27:36 -04:00
fmt_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
info_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
inspector_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
install_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
lint_tests.rs feat(lint): add support for config file and CLI flags for rules (#11776) 2021-09-03 17:01:58 +02:00
lsp_tests.rs chore(test): improve flaky lsp_diagnostics_refresh_dependents test to give more info (#11905) 2021-09-02 20:31:59 -04:00
mod.rs fix(http/ws): support multiple options in connection header (#11675) 2021-08-13 20:52:13 +02:00
repl_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00
run_tests.rs Don't drop messages from workers that have already been closed (#11913) 2021-09-06 11:05:02 +02:00
test_tests.rs feat(cli): close test worker once all tests complete (#11727) 2021-09-04 20:19:26 +02:00
upgrade_tests.rs fix(cli/tools/upgrade): check if passed version is valid (#11296) 2021-07-07 14:59:39 -04:00
watcher_tests.rs fix(cli): dispatch unload event on watch drop (#11696) 2021-08-24 22:34:09 +02:00
worker_tests.rs chore: move test files to testdata directory (#11601) 2021-08-11 10:20:47 -04:00