summaryrefslogtreecommitdiff
path: root/runtime/ops
AgeCommit message (Collapse)Author
2021-09-25cleanup(runtime): flatten op_kill's args (#12214)Aaron O'Mullan
2021-09-22fix(workers): Don't panic when a worker's parent thread stops running (#12156)Andreu Botella
This panic could happen in the following cases: - A non-fatal error being thrown from a worker, that doesn't terminate the worker's execution, but propagates to the main thread without being handled, and makes the main thread terminate. - A nested worker being alive while its parent worker gets terminated. - A race condition if the main event loop terminates the worker as part of its last task, but the worker doesn't fully terminate before the main event loop stops running. This panic happens because a worker's event loop should have pending ops as long as the worker isn't closed or terminated – but if an event loop finishes running while it has living workers, its associated `WorkerThread` structs will be dropped, closing the channels that keep those ops pending. This change adds a `Drop` implementation to `WorkerThread`, which terminates the worker without waiting for a response. This fixes the panic, and makes it so nested workers are automatically terminated once any of their ancestors is closed or terminated. This change also refactors a worker's termination code into a `WorkerThread::terminate()` method. Closes #11342. Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-09-21fix(runtime/ops/signal.rs): Add FreeBSD signal definitions (#12084)MikaelUrankar
2021-09-14chore: bump crate versions for 0.14 (#12072)David Sherret
2021-09-13feat(unstable): allow specifing gid and uid for subprocess (#11586)Leo K
2021-09-07fix: remove windows-only panic when calling `Deno.kill` (#11948)David Sherret
2021-09-07fix(runtime): return error instead of panicking for windows signals (#11940)Casper Beyer
2021-09-07refactor(lsp): use deno_ast and cache swc ASTs (#11780)David Sherret
2021-09-06BREAKING(unstable): Remove Deno.Signals enum, Deno.signals.* (#11909)Ryan Dahl
2021-09-06Don't drop messages from workers that have already been closed (#11913)Andreu Botella
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-02chore: update dependencies (#11856)Luca Casonato
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2021-08-24feat(unstable): Add file locking APIs (#11746)Tilman Roeder
This commit adds following unstable APIs: - Deno.flock() - Deno.flockSync() - Deno.funlock() - Deno.funlockSync()
2021-08-18fix(runtime): event loop panics in classic workers (#11756)Luca Casonato
Classic worker scripts are now executed in the context of a Tokio runtime. This does mean we can not spawn more tokio runtimes in "op_worker_sync_fetch". We instead spawn a new thread there, that can create a new Tokio runtime that we can use to block the worker thread.
2021-08-16feat(runtime): support classic workers for internal testing (#11338)Andreu Botella
This commit implements classic workers, but only when the `--enable-testing-features-do-not-use` flag is provided. This change is not user facing. Classic workers are used extensively in WPT tests. The classic workers do not support loading from disk, and do not support TypeScript. Co-authored-by: Luca Casonato <hello@lcas.dev>
2021-08-15refactor(ops): return BadResource errors in ResourceTable calls (#11710)Aaron O'Mullan
* refactor(ops): return BadResource errors in ResourceTable calls Instead of relying on callers to map Options to Results via `.ok_or_else(bad_resource_id)` at over 176 different call sites ...
2021-08-06feat: ffi to replace plugins (#11152)Elias Sjögreen
This commit removes implementation of "native plugins" and replaces it with FFI API. Effectively "Deno.openPlugin" API was replaced with "Deno.dlopen" API.
2021-08-04feat(unstable): clean environmental variables for subprocess (#11571)Leo K
This commit adds "Deno.RunOptions.clearEnv" option, that allows to clear environmental variables from parent process before spawning a subprocess.
2021-08-03chore: surface import map JSON parse error to user (#11573)David Sherret
2021-07-30chore: upgrade Rust to 1.54.0 (#11554)Yusuke Tanaka
2021-07-29feat(runtime): implement navigator.hardwareConcurrency (#11448)Divy Srivastava
This commit implements "navigator.hardwareConcurrency" API, which supersedes "Deno.systemCpuInfo()" API (which was removed in this commit).
2021-07-17fix(workers): silently ignore non-existent worker IDs (#11417)Andreu Botella
Fixes #11416
2021-07-12refactor: deno_http op crate (#11335)Luca Casonato
2021-07-11Revert "Remove unstable native plugins (#10908)"Ryan Dahl
This reverts commit 7dd4090c2a3dc0222fd6ff611eeb2bd69cd28224.
2021-07-06chore: use parking_lot for synchronization primitives to align with tokio ↵David Sherret
(#11289) parking_lot is already transitively used in tokio via the "full" cargo feature
2021-07-02Remove unstable native plugins (#10908)Bartek Iwańczuk
This commit removes implementation of native plugins alongside the unstable "Deno.openPlugin()" API.
2021-06-29feat: Add "deno_net" extension (#11150)Bartek Iwańczuk
This commits moves implementation of net related APIs available on "Deno" namespace to "deno_net" extension. Following APIs were moved: - Deno.listen() - Deno.connect() - Deno.listenTls() - Deno.serveHttp() - Deno.shutdown() - Deno.resolveDns() - Deno.listenDatagram() - Deno.startTls() - Deno.Conn - Deno.Listener - Deno.DatagramConn
2021-06-28fix(http): remove unwrap() in HTTP bindings (#11130)Bartek Iwańczuk
2021-06-27fix(runtime/http): Encode and decode headers as byte strings in the HTTP ↵Andreu Botella
server (#11144)
2021-06-25fix(runtime/signal): use op_async_unref for op_signal_poll (#11097)Yoshiya Hinosawa
2021-06-22feat: transfer MessagePort between workers (#11076)Luca Casonato
Add support for transferring `MessagePort`s between workers.
2021-06-17chore: upgrade Rust to 1.53.0 (#11021)Yusuke Tanaka
2021-06-15Remove various unnecessary allow(clippy) declarations (#10971)Ryan Dahl
2021-06-14fix: poll connection after writing response chunk in Deno.serveHttp() (#10961)Bartek Iwańczuk
This commit changes "op_http_response_write" to first send response chunk and then poll the underlying HTTP connection. Previously after writing a chunk of response HTTP connection wasn't polled and thus data wasn't written to the socket until after next op interacting with the connection.
2021-06-14fix: hang in Deno.serveHttp() (#10923)Bartek Iwańczuk
Waiting on next request in Deno.serveHttp() API hanged when responses were using ReadableStream. This was caused by op_http_request_next op that was never woken after response was fully written. This commit adds waker field to DenoService which is called after response is finished.
2021-06-04fix: hang in op_http_next_request (#10836)Bartek Iwańczuk
This commit adds "CancelHandle" to "ConnResource" and changes "op_http_next_request" to await for the cancel signal. In turn when async iterating over "Deno.HttpConn" the iterator breaks upon closing of the resource.
2021-05-11feat(runtime/worker): Structured cloning worker message passing (#9323)Tim Ramlot
This commit upgrade "Worker.postMessage()" implementation to use structured clone algorithm instead of non-spec compliant JSON serialization.
2021-05-11fix(tls): flush send buffer in the background after closing TLS stream (#10146)Bert Belder
In #9118, TLS streams were split into a "read half" and a "write half" using tokio::io::split() to allow concurrent Conn#read() and Conn#write() calls without one blocking the other. However, this introduced a bug: outgoing data gets discarded when the TLS stream is gracefully closed, because the read half is closed too early, before all TLS control data has been received. Fixes: #9692 Fixes: #10049 Fixes: #10296 Fixes: denoland/deno_std#750
2021-05-08cleanup(ops): remove unused ZeroCopyBuf arg-types (#10530)Aaron O'Mullan
2021-05-07fix: align plugin api with Extension (#10427)Elias Sjögreen
2021-05-06refactor(ops): replace `ZeroCopyBuf` arg by 2nd generic deserializable arg ↵Aaron O'Mullan
(#10448)
2021-05-02refactor(runtime): use Extensions (#10461)Aaron O'Mullan
2021-04-28core: introduce extensions (#9800)Aaron O'Mullan
Extensions allow declarative extensions to "JsRuntime" (ops, state, JS or middleware). This allows for: - `op_crates` to be plug-and-play & self-contained, reducing complexity leaked to consumers - op middleware (like metrics_op) to be opt-in and for new middleware (unstable, tracing,...) - `MainWorker` and `WebWorker` to be composable, allowing users to extend workers with their ops whilst benefiting from the other infrastructure (inspector, etc...) In short extensions improve deno's modularity, reducing complexity and leaky abstractions for embedders and the internal codebase.
2021-04-26fix(tls): throw meaningful error when hostname is invalid (#10387)Bert Belder
`InvalidDNSNameError` is thrown when a string is not a valid hostname, e.g. it contains invalid characters, or starts with a numeric digit. It does not involve a (failed) DNS lookup.
2021-04-25feat(cli): add test permissions to Deno.test (#10188)Casper Beyer
This commits adds adds "permissions" option to the test definitions which allows tests to run with different permission sets than the process's permission. The change will only be in effect within the test function, once the test has completed the original process permission set is restored. Test permissions cannot exceed the process's permission. You can only narrow or drop permissions, failure to acquire a permission results in an error being thrown and the test case will fail.
2021-04-21fix: do not panic on not found cwd (#10238)Satya Rohith
2021-04-20chore: align fetch to spec (#10203)Luca Casonato
This commit aligns the `fetch` API and the `Request` / `Response` classes belonging to it to the spec. This commit enables all the relevant `fetch` WPT tests. Spec compliance is now at around 90%. Performance is essentially identical now (within 1% of 1.9.0).
2021-04-20chore: update copyright headers (#10243)Yoshiya Hinosawa
2021-04-19fix(rt/http): correct URL in Request (#10256)Luca Casonato
This commit fixes the URL returned from `request.url` in the HTTP server to be fully qualified. This previously existed, but was removed and accidentially not readded during optimizations of the HTTP ops. Returning a non fully qualified URL from `Request#url` is not spec compliant.
2021-04-15fix(#10182): hang during http server response (#10197)Ryan Dahl
2021-04-14refactor: move timers to deno_timers op crate (#10179)Ben Noordhuis
Move timers out of runtime/ and into a standalone op crate.