Open 1cedsoda opened 10 months ago
This is likely a difference in behaviour for when listening to the same port twice. We will fix it.
Can confirm, it only happens if the same port is used multiple times.
I can confirm that calling server.stop(true)
instead of server.stop()
here: https://github.com/oven-sh/bun/blob/main/src/js/node/http.ts#L446
does fix the issue, @Electroid is this something which would be okay to do?
I can confirm that calling
server.stop(true)
instead ofserver.stop()
here: https://github.com/oven-sh/bun/blob/main/src/js/node/http.ts#L446 does fix the issue, @Electroid is this something which would be okay to do?
Yep, that should be a good fix.
Still appears in 1.1.0+5903a6141
What version of Bun is running?
1.0.11+f7f6233ea
What platform is your computer?
Darwin 23.0.0 arm64 arm
What steps can reproduce the bug?
Running
bun x.js
Expected: numbers to be different Got: numbers are same
Running
node x.js
Expected: numbers to be different Got: numbers are different
What is the expected behavior?
Bun: numbers should be different (middlewares are redeclared) Express: numbers should be different (middlewares are redeclared)
What do you see instead?
Bun: numbers are the same (middlewares are reused) Express: numbers should be different (middlewares are redeclared
Findings
In Bun the express middlewares seem to be reused.
Additional information
node version
v18.18.2
express version4.18.2