Make a simple bun hono server which serves a single index.html file
import { Hono } from "hono";
import { serveStatic } from "hono/bun";
const app = new Hono();
export type App = typeof app;
app.get("/", serveStatic({ path: "./static/index.html" }));
export default app;
run a k6 load test against it
import http from "k6/http";
import { check } from "k6";
import { Rate } from "k6/metrics";
export let errorRate = new Rate("errors");
export let options = {
vus: 10,
duration: "10s",
thresholds: {
errors: ["rate<0.01"], // <1% errors
http_req_duration: ["p(99)<1000"], // 99% of requests must complete below 1s
},
};
export default function () {
let res = http.get("http://localhost:3000");
check(res, {
"status is 200": (r) => r.status === 200,
});
errorRate.add(res.status !== 200);
}
you'll get tons of errors
024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
WARN[0000] Request Failed error="Get \"http://localhost:3000\": net/http: HTTP/1.x transport connection broken: malformed HTTP response \"\""
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/24 15:08:20 Unsolicited response received on idle HTTP channel starting with "\r\n"; err=<nil>
INFO[0000] 2024/07/2
I've tried this with express, I've tried with hono/node-server, I've tried this with uWebSocket. This issue seems to only happen when using bun + hono.
What is the expected behavior?
I wouldn't expect any errors when running a k6 load test
What version of Hono are you using?
4.5.0
What runtime/platform is your app running on?
Bun
What steps can reproduce the bug?
Make a simple bun hono server which serves a single index.html file
run a k6 load test against it
you'll get tons of errors
I've tried this with express, I've tried with hono/node-server, I've tried this with uWebSocket. This issue seems to only happen when using bun + hono.
What is the expected behavior?
I wouldn't expect any errors when running a k6 load test
What do you see instead?
No response
Additional information
No response