1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00
Commit graph

2436 commits

Author SHA1 Message Date
Leo Kettmeir
8ca8174c81
refactor(ext/crypto): use concrete error types (#26167) 2024-10-18 15:23:20 -07:00
Nathan Whitaker
d48434e91f
fix(ext/node): stub HTTPParser internal binding (#26401)
Fixes https://github.com/denoland/deno/issues/26394.
2024-10-18 21:39:32 +00:00
Leo Kettmeir
d047cab14b
refactor(ext/websocket): use concrete error type (#26226) 2024-10-18 19:30:46 +00:00
Nathan Whitaker
1bccf45ecb
fix(ext/node): properly map reparse point error in readlink (#26375) 2024-10-18 10:11:06 -07:00
Leo Kettmeir
85a99eb405
refactor(ext/fs): use concrete error types (#26317) 2024-10-18 06:38:17 -07:00
denobot
3ae10a01e0
chore: forward v2.0.2 release commit to main (#26376)
This is the release commit being forwarded back to main for 2.0.2

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-18 03:12:49 +02:00
Bartek Iwańczuk
8f3eb9d0e7
fix(ext/node): add null check for kStreamBaseField (#26368)
It's not guaranteed that `kStreamBaseField` is not undefined, so
added a check for it.

Closes https://github.com/denoland/deno/issues/26363
2024-10-17 22:57:05 +00:00
Leo Kettmeir
8cfd9968fa
refactor(ext/napi): use concrete error types (#26186) 2024-10-17 19:51:33 +00:00
Nathan Whitaker
9fde5cb5e0
fix(node/fs): copyFile with COPYFILE_EXCL should not throw if the destination doesn't exist (#26360)
Fixes #26313.

We were checking for the NotFound error, but still calling the callback
with the error / throwing.
2024-10-17 19:51:15 +00:00
Leo Kettmeir
eca83fc9b4
refactor(ext/web): use concrete error types (#26185) 2024-10-17 19:05:38 +00:00
Leo Kettmeir
7c790da826
refactor(ext/kv): use concrete error type (#26239) 2024-10-17 17:59:02 +00:00
Leo Kettmeir
ed13efc4ac
refactor(ext/net): use concrete error type (#26227) 2024-10-17 09:43:04 -07:00
Nathan Whitaker
a61ba3c699
fix(net): don't try to set nodelay on upgrade streams (#26342)
Fixes https://github.com/denoland/deno/issues/26341.

We try to call `op_set_nodelay` on an `UpgradeStream`, which doesn't
support that operation.
2024-10-17 03:56:57 +00:00
Nathan Whitaker
167f674c7c
fix: don't warn on ignored signals on windows (#26332)
Closes #26183.

The warnings are super noisy and not actionable for the user
2024-10-16 19:58:11 -07:00
Nathan Whitaker
458d6278d2
fix(node/http): normalize header names in ServerResponse (#26339)
Fixes https://github.com/denoland/deno/issues/26115.

We weren't normalizing the headers to lower case, so code that attempted
to delete the `Content-Length` header (but used a different case) wasn't
actually removing the header.
2024-10-17 00:42:15 +00:00
denobot
3385d1252e
chore: forward v2.0.1 release commit to main (#26338)
This is the release commit being forwarded back to main for 2.0.1

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-16 23:48:42 +00:00
Nathan Whitaker
f7dba52133
fix(child_process): map node --no-warnings flag to --quiet (#26288)
Closes https://github.com/denoland/deno/issues/25899
2024-10-16 18:25:25 +00:00
Yoshiya Hinosawa
d59599fc18
fix(ext/node): fix dns.lookup result ordering (#26264)
partially unblocks #25470

This PR aligns the resolution of `localhost` hostname to Node.js
behavior.

In Node.js `dns.lookup("localhost", (_, addr) => console.log(addr))`
prints ipv6 address `::1`, but it prints ipv4 address `127.0.0.1` in
Deno. That difference causes some errors in the work of enabling
`createConnection` option in `http.request` (#25470). This PR fixes the
issue by aligning `dns.lookup` behavior to Node.js.

This PR also changes the following behaviors (resolving TODOs):
- `http.createServer` now listens on ipv6 address `[::]` by default on
linux/mac
- `net.createServer` now listens on ipv6 address `[::]` by default on
linux/mac

These changes are also alignments to Node.js behaviors.
2024-10-16 20:58:44 +09:00
Divy Srivastava
21fa953f32
fix(ext/node): timingSafeEqual account for AB byteOffset (#26292)
Fixes https://github.com/denoland/deno/issues/26276
2024-10-16 14:27:28 +05:30
David Sherret
661882f10d
perf(http): make heap allocation for path conditional (#26289)
Code:

```js
Deno.serve({ port: 8085 }, request => {
  return new Response(request.url);
});
```

Before:

```
% wrk -d60s http://localhost:8085/path/testing\?testing=5
Running 1m test @ http://localhost:8085/path/testing?testing=5
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    56.01us   18.34us   3.28ms   93.84%
    Req/Sec    81.80k     3.13k   88.26k    90.77%
  9783713 requests in 1.00m, 1.67GB read
Requests/sec: 162789.89
Transfer/sec:     28.41MB
```

After:

```
% wrk -d60s http://localhost:8085/path/testing\?testing=5
Running 1m test @ http://localhost:8085/path/testing?testing=5
  2 threads and 10 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency    55.44us   15.20us   2.42ms   90.41%
    Req/Sec    82.71k     2.92k   88.10k    89.93%
  9892916 requests in 1.00m, 1.69GB read
Requests/sec: 164607.06
Transfer/sec:     28.73MB
```
2024-10-16 00:43:20 -04:00
Leo Kettmeir
82d13fd45b
refactor(ext/io): use concrete error types (#26187) 2024-10-15 15:36:11 -07:00
Leo Kettmeir
3065dadea3
fix(ext/console): apply coloring for console.table (#26280)
Fixes #26159
2024-10-15 21:36:45 +00:00
Kenta Moriuchi
7211028f1e
fix(ext/node): use primordials in ext/node/polyfills/internal/buffer.mjs (#24993)
Towards #24236
2024-10-15 20:32:27 +02:00
Toby Ealden
c5a7f98d82
fix(ext/node): handle http2 server ending stream (#26235)
Closes #24845
2024-10-15 23:35:10 +05:30
Divy Srivastava
c7153838ec
fix(ext/node): implement TCP.setNoDelay (#26263)
Fixes https://github.com/denoland/deno/issues/26177

The significant delay was caused by Nagel's algorithm + delayed ACKs in
Linux kernels. Here's the [kernel
patch](https://lwn.net/Articles/502585/) which added 40ms
`tcp_default_delack_min`

```
$ deno run -A pg-bench.mjs # main
Tue Oct 15 2024 12:27:22 GMT+0530 (India Standard Time): 42ms

$ target/release/deno run -A pg-bench.mjs # this patch
Tue Oct 15 2024 12:28:02 GMT+0530 (India Standard Time): 1ms
```

```js
import { Buffer } from "node:buffer";

import pg from 'pg'
const { Client } = pg
const client = new Client({
    connectionString: 'postgresql://postgres:postgres@127.0.0.1:5432/postgres'
})
await client.connect()

async function fetch() {
    const startPerf = performance.now();
    const res = await client.query(`select
        $1::int as int,
        $2 as string,
        $3::timestamp with time zone as timestamp,
        $4 as null,
        $5::bool as boolean,
        $6::bytea as bytea,
        $7::jsonb as json
      `, [
        1337,
        'wat',
        new Date().toISOString(),
        null,
        false,
        Buffer.from('awesome'),
        JSON.stringify([{ some: 'json' }, { array: 'object' }])
    ])
    console.log(`${new Date()}: ${Math.round(performance.now() - startPerf)}ms`)
}

for(;;) await fetch();
```
2024-10-15 14:47:12 +05:30
David Sherret
7f3747f2ef
perf(http): avoid clone getting request method and url (#26250) 2024-10-14 23:25:47 -04:00
David Sherret
4c9eee3ebe
perf(http): cache webidl.converters lookups in ext/fetch/23_response.js (#26256) 2024-10-14 23:25:18 -04:00
Leo Kettmeir
ee7d450143
refactor(ext/ffi): use concrete error types (#26170) 2024-10-14 15:05:49 -07:00
Mohammad Sulaiman
8dbe77dd29
fix(console/ext/repl): support using parseFloat() (#25900)
Fixes #21428

Co-authored-by: tannal <tannal2409@gmail.com>
2024-10-14 15:04:18 -07:00
Leo Kettmeir
48cbf85add
refactor(ext/url): use concrete error types (#26172) 2024-10-14 14:15:31 -07:00
Leo Kettmeir
cb385d9e4a
refactor(ext/webstorage): use concrete error types (#26173) 2024-10-14 13:53:17 -07:00
Divy Srivastava
dfbf03eee7
perf: use fast calls for microtask ops (#26236)
Updates deno_core to 0.312.0
2024-10-14 12:31:51 +00:00
Divy Srivastava
bbad7c5922
fix(ext/node): compute pem length (upper bound) for key exports (#26231)
Fixes https://github.com/denoland/deno/issues/26188
2024-10-14 14:24:26 +05:30
Divy Srivastava
68b388a93a
fix(ext/node): allow writing to tty columns (#26201)
Behave similar to Node.js where modifying `stdout.columns` doesn't
really resize the terminal. Ref
https://github.com/nodejs/node/issues/17529

Fixes https://github.com/denoland/deno/issues/26196
2024-10-14 14:00:02 +05:30
Divy Srivastava
7c3da2ec1c
fix(ext/webgpu): allow GL backend on Windows (#26206)
It should be supported according to
[this](https://github.com/gfx-rs/wgpu?tab=readme-ov-file#supported-platforms).

Fixes https://github.com/denoland/deno/issues/26144
2024-10-14 11:10:27 +05:30
Leo Kettmeir
64c304a452
refactor(ext/tls): use concrete error types (#26174) 2024-10-12 16:53:38 -07:00
Leo Kettmeir
2ac699fe6e
refactor(ext/cron): use concrete error type (#26135) 2024-10-12 14:23:49 -07:00
Nathan Whitaker
4f89225f76
fix(node/util): export styleText from node:util (#26194)
Fixes #26184.

It was added but not publicly exported.
2024-10-12 19:36:23 +00:00
Leo Kettmeir
8b2c6fc2d2
refactor(ext/canvas): use concrete error type (#26111) 2024-10-12 10:00:35 -07:00
Leo Kettmeir
938a8ebe34
refactor(ext/cache): use concrete error type (#26109) 2024-10-12 09:15:10 -07:00
Leo Kettmeir
3df8f16500
refactor(ext/broadcastchannel): use concrete error type (#26105) 2024-10-12 08:20:17 -07:00
Marvin Hagemeister
9117a9a43c
fix(node): make process.stdout.isTTY writable (#26130)
Fixes https://github.com/denoland/deno/issues/26123
2024-10-11 19:14:10 +02:00
denobot
a62c7e036a
2.0.0 (#26063)
Bumped versions for 2.0.0

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-08 07:37:28 -07:00
Satya Rohith
ff4e682ff9
fix(ext/node): internal buffer length in readSync (#26064)
Closes https://github.com/denoland/deno/issues/26054
2024-10-08 10:41:32 +00:00
Marvin Hagemeister
2d488e4bfb
fix(console): missing cause property on non-error objects (#26061)
Fixes https://github.com/denoland/deno/issues/26047
2024-10-08 12:10:19 +02:00
Leo Kettmeir
9a92603a14
fix(ext/webstorage): make getOwnPropertyDescriptor with symbol return undefined (#13348)
Closes #13347
2024-10-07 07:59:27 -07:00
Divy Srivastava
39a2034967
feat(ext/crypto): X448 support (#26043)
Signed-off-by: Divy Srivastava <dj.srivastava23@gmail.com>
2024-10-07 12:04:40 +01:00
David Sherret
2de4faa483
refactor: improve node permission checks (#26028)
Does less work when requesting permissions with `-A`
2024-10-04 20:55:41 +01:00
Nathan Whitaker
dd8cbf5e29
fix(node): fix worker_threads issues blocking Angular support (#26024)
Fixes #22995. Fixes #23000.

There were a handful of bugs here causing the hang (each with a
corresponding minimized test):

- We were canceling recv futures when `receiveMessageOnPort` was called,
but this caused the "receive loop" in the message port to exit. This was
due to the fact that `CancelHandle`s are never reset (i.e., once you
`cancel` a `CancelHandle`, it remains cancelled). That meant that after
`receieveMessageOnPort` was called, the subsequent calls to
`op_message_port_recv_message` would throw `Interrupted` exceptions, and
we would exit the loop.

The cancellation, however, isn't actually necessary.
`op_message_port_recv_message` only borrows the underlying port for long
enough to poll the receiver, so the borrow there could never overlap
with `op_message_port_recv_message_sync`.

- Calling `MessagePort.unref()` caused the "receive loop" in the message
port to exit. This was because we were setting
`messageEventListenerCount` to 0 on unref. Not only does that break the
counter when multiple `MessagePort`s are present in the same thread, but
we also exited the "receive loop" whenever the listener count was 0. I
assume this was to prevent the recv promise from keeping the event loop
open.

Instead of this, I chose to just unref the recv promise as needed to
control the event loop.

- The last bug causing the hang (which was a doozy to debug) ended up
being an unfortunate interaction between how we implement our
messageport "receive loop" and a pattern found in `npm:piscina` (which
angular uses). The gist of it is that piscina uses an atomic wait loop
along with `receiveMessageOnPort` in its worker threads, and as the
worker is getting started, the following incredibly convoluted series of
events occurs:
   1. Parent sends a MessagePort `p` to worker
   2. Parent sends a message `m` to the port `p`
3. Parent notifies the worker with `Atomics.notify` that a new message
is available
   4. Worker receives message, adds "message" listener to port `p`
   5. Adding the listener triggers `MessagePort.start()` on `p`
6. Receive loop in MessagePort.start receives the message `m`, but then
hits an await point and yields (before dispatching the "message" event)
7. Worker continues execution, starts the atomic wait loop, and
immediately receives the existing notification from the parent that a
message is available
8. Worker attempts to receive the new message `m` with
`receiveMessageOnPort`, but this returns `undefined` because the receive
loop already took the message in 6
9. Atomic wait loop continues to next iteration, waiting for the next
message with `Atomic.wait`
10. `Atomic.wait` blocks the worker thread, which prevents the receive
loop from continuing and dispatching the "message" event for the
received message
11. The parent waits for the worker to respond to the first message, and
waits
12. The thread can't make any more progress, and the whole process hangs

The fix I've chosen here (which I don't particularly love, but it works)
is to just delay the `MessagePort.start` call until the end of the event
loop turn, so that the atomic wait loop receives the message first. This
prevents the hang.

---

Those were the main issues causing the hang. There ended up being a few
other small bugs as well, namely `exit` being emitted multiple times,
and not patching up the message port when it's received by
`receiveMessageOnPort`.
2024-10-04 09:26:32 -07:00
Divy Srivastava
e54809f2d5
fix(ext/crypto): fix identity test for x25519 derive bits (#26011) 2024-10-03 16:46:48 +05:30