Open uxmaster opened 10 months ago
Can you paste code that reproduces this? This isn't enough information
Here goes the code:
import mysql2 from 'mysql2/promise';
const mysql = mysql2.createPool({
socketPath: '/var/run/mysqld/mysqld.sock',
user: 'user',
password: 'password',
});
Bun.serve({
async fetch(req) {
await mysql.execute('SELECT 1');
return new Response('Bun!');
},
});
And:
curl http://localhost:3000
@Jarred-Sumner I pasted the code. What else can I do to help debug this bug?
This is affecting one of our production servers, so it's kind of important for me to fix it.
Oddly enough adding
await mysql.query('SELECT 2');
before
Bun.serve({
...
fixes the problem.
This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.
What version of Bun is running?
1.0.27
What platform is your computer?
Linux 5.15.0-91-generic x86_64 x86_64
What steps can reproduce the bug?
A request made to the Bun HTTP server (handled asynchronously and executing a statement in MySQL through mysql2).
What is the expected behavior?
CPU usage should return to 0 after the request.
What do you see instead?
CPU usage stays at 100% (IO Watcher thread).
Additional information
It seems that version 1.0.19 introduced this bug, since up to 1.0.18 everything is OK.
Also, this is machine dependent. It's failing on DigitalOcean regular 1vCPU droplet in nyc1, while it runs OK on Vultr's High Frequency 1vCPU virtual machine in Chicago (same OS and kernel).