oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.2k stars 2.77k forks source link

`mongoose` timeout error occurs when running with `bun` but not when running with `tsx` #12306

Open atbe opened 4 months ago

atbe commented 4 months ago

What version of Bun is running?

1.1.17+bb66bba1b

What platform is your computer?

Linux 6.6.31-linuxkit x86_64 unknown

What steps can reproduce the bug?

When attempting to use mongoose at runtime with bun, we run into the error. We swap bun for tsx and there's no error. We'll try to isolate the code-path to understand exactly what call is causing the timeout.

What is the expected behavior?

That the program operates normally, and all mongoose calls succeed.

What do you see instead?

We see the following runtime error:

[SystemService]: 2024-07-02T18:33:10.188Z 4 Error: 181 |       timeout = setTimeout(() => {
182 |         const removed = this.removeQueue(i, _args);
183 |         if (removed) {
184 |           const message = 'Operation `' + this.name + '.' + i + '()` buffering timed out after ' +
185 |             bufferTimeoutMS + 'ms';
186 |           const err = new MongooseError(message);
                                 ^
MongooseError: Operation `systems.findOne()` buffering timed out after 10000ms
      at new MongooseError (:1:28)
      at /usr/src/app/node_modules/.pnpm/mongoose@8.2.1_socks@2.8.3/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:186:27

Additional information

No response

cirospaciari commented 2 months ago

I believe this was fixed with https://github.com/oven-sh/bun/issues/13736 and other timeout related fixes, can you see if still reproduces after bun upgrade --canary?

ChristoPy commented 2 weeks ago

Hi, still having this issue, even in canary

christopy@MacBook-Pro-de-Christopher new-fintech % bun dev
$ bun run --watch src/index.ts
🦊 Elysia is running at localhost:9999
180 |       timeout = setTimeout(() => {
181 |         const removed = this.removeQueue(i, _args);
182 |         if (removed) {
183 |           const message = 'Operation `' + this.name + '.' + i + '()` buffering timed out after ' +
184 |             bufferTimeoutMS + 'ms';
185 |           const err = new MongooseError(message);
                            ^
MongooseError: Operation `accounts.findOne()` buffering timed out after 10000ms
      at new MongooseError (1:23)
      at /Users/christopy/code/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js:185:23

Bun version:

1.1.34