Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http2 server ECONNRESET on http1.1 request #54998

Open
VanillaMaster opened this issue Sep 18, 2024 · 1 comment
Open

http2 server ECONNRESET on http1.1 request #54998

VanillaMaster opened this issue Sep 18, 2024 · 1 comment
Labels
http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem.

Comments

@VanillaMaster
Copy link

VanillaMaster commented Sep 18, 2024

Version

v22.9.0

Platform

Microsoft Windows NT 10.0.19045.0 x64

Subsystem

node:http2

What steps will reproduce the bug?

http1.1 requests made from Hoppscotch v2024.8.2 to node js http2 server without http1 fallback cause Uncaught Error Error: read ECONNRESET

/**@import { SecureServerOptions } from "node:http2" */
import { createSecureServer } from "node:http2"
import { readFile } from "node:fs/promises";
import { env } from "node:process";

const [
    key,
    cert
] = await Promise.all([
    readFile(env.PEM_KEY, "utf-8"),
    readFile(env.PEM_CRT, "utf-8")
]);

/**@type { SecureServerOptions } */
const options = { key, cert, allowHTTP1: false };

const server = createSecureServer(options);

server.listen(8080);

How often does it reproduce? Is there a required condition?

unconditional error

What is the expected behavior? Why is that the expected behavior?

this error related to server, so being able to catch error on server instance, or dont get this error at all (handled implicitly)

What do you see instead?

i was able to handle this error only using

process.on("uncaughtException", /*...*/)

Additional information

if allowHTTP1 enabled no error thrown

Uncaught Error Error: read ECONNRESET
    at onStreamRead (internal/stream_base_commons:216:20)
    at callbackTrampoline (internal/async_hooks:130:17)
    --- TickObject ---
    at init (internal/inspector_async_hook:25:19)
    at emitInitNative (internal/async_hooks:202:43)
    at emitInitScript (internal/async_hooks:505:3)
    at nextTick (internal/process/task_queues:143:5)
    at onDestroy (internal/streams/destroy:116:15)
    at Socket._destroy (net:839:5)
    at _destroy (internal/streams/destroy:122:10)
    at destroy (internal/streams/destroy:84:5)
    at Writable.destroy (internal/streams/writable:1122:11)
    at onStreamRead (internal/stream_base_commons:216:12)
    at callbackTrampoline (internal/async_hooks:130:17)
    --- TLSWRAP ---
    at init (internal/inspector_async_hook:25:19)
    at emitInitNative (internal/async_hooks:202:43)
    at TLSSocket._wrapHandle (_tls_wrap:699:24)
    at TLSSocket (_tls_wrap:570:18)
    at tlsConnectionListener (_tls_wrap:1232:18)
    at emit (events:519:28)
    at onconnection (net:2259:8)
    at callbackTrampoline (internal/async_hooks:130:17)
    --- TCPSERVERWRAP ---
    at init (internal/inspector_async_hook:25:19)
    at emitInitNative (internal/async_hooks:202:43)
    at createServerHandle (net:1827:14)
    at setupListenHandle (net:1870:14)
    at listenInCluster (net:1965:12)
    at Server.listen (net:2067:7)
    at <anonymous> (c:\Users\VM\Desktop\protov2\src\tmp.js:23:8)
    --- await ---
    at run (internal/modules/esm/module_job:262:25)
    --- await ---
    at onImport.tracePromise.__proto__ (internal/modules/esm/loader:483:42)
    at processTicksAndRejections (internal/process/task_queues:105:5)
    --- await ---
    at tracePromise (diagnostics_channel:337:14)
    at import (internal/modules/esm/loader:481:21)
    at <anonymous> (internal/modules/run_main:176:35)
    at asyncRunEntryPointWithESMLoader (internal/modules/run_main:117:11)
    at runEntryPointWithESMLoader (internal/modules/run_main:139:19)
    at executeUserEntryPoint (internal/modules/run_main:173:5)
    at <anonymous> (internal/main/run_main_module:30:49)
@VanillaMaster
Copy link
Author

in docs specified
If no listener is registered for this event, the connection is terminated
but only mannual closing resolves the error

server.on("unknownProtocol", function(socket) {
    socket.end();
})

@RedYetiDev RedYetiDev added http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem. labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
http Issues or PRs related to the http subsystem. http2 Issues or PRs related to the http2 subsystem.
Projects
None yet
Development

No branches or pull requests

2 participants