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

Segmentation fault at both --hot and --watch modes running expressjs server with ES modules #3161

Closed
sukalov opened this issue Jun 1, 2023 · 2 comments · Fixed by #3174 · May be fixed by #3173
Closed

Segmentation fault at both --hot and --watch modes running expressjs server with ES modules #3161

sukalov opened this issue Jun 1, 2023 · 2 comments · Fixed by #3174 · May be fixed by #3173
Labels
bug Something isn't working

Comments

@sukalov
Copy link

sukalov commented Jun 1, 2023

What version of Bun is running?

0.6.6

What platform is your computer?

Darwin 22.4.0 arm64 arm

What steps can reproduce the bug?

I have a simple node express server running phonebook with minimal API, which can be found at this repo. I've been using it to play around with got stuck with this segfault error. I tried 4 scripts:

  1. bun --hot index.js
  2. bun run --hot index.js
  3. bun --watch index.js
  4. bun run --watch index.js

They all returned the same, and upgrading bun to canary didn't solve the issue overall, but it did run in --hot mode ONCE (soon it crushed segfault too).

However, when I tried it with another simple express server, that uses CommonJS modules instead of ES modules, both worked fine.

What is the expected behavior?

# at app using CJS modules
bun run --hot index.js  # saving several times
Example app listening on port 3000
Example app listening on port 3000
Example app listening on port 3000
Example app listening on port 3000
Example app listening on port 3000
Example app listening on port 3000

What do you see instead?

# at app using ES modules
bun run --hot index.js  
[0.16ms] ".env"
connecting to mongodb+srv://<................>
connected to MongoDB
[1]    3391 segmentation fault  bun run --hot index.js

Additional information

No response

@sukalov sukalov added the bug Something isn't working label Jun 1, 2023
@Jarred-Sumner
Copy link
Collaborator

Looked at it a little, something to do with Mongoose + node:net, I think. Likely some arguments parsing which is incorrect

@sukalov
Copy link
Author

sukalov commented Jun 2, 2023

Looked at it a little, something to do with Mongoose + node:net, I think. Likely some arguments parsing which is incorrect

oh, interesting. i didn't think it might be mongoose. I can implement mongoose to the second repo to check, how it behaves with commonjs modules, if you wish

Jarred-Sumner added a commit that referenced this issue Jun 2, 2023
Jarred-Sumner added a commit that referenced this issue Jun 2, 2023
* Fixes #3161

* Fix the error message

* woops

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants