oven-sh / bun

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

Segmentation Fault at address 0x0 #9707

Open duckytutorials opened 5 months ago

duckytutorials commented 5 months ago

What version of Bun is running?

1.0.35-canary.19+fa145b221

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

Create a ExpressJS Server, run bun . send a request and wait or send a few more and it will give bug

What is the expected behavior?

No response

What do you see instead?

Segmentation fault at address 0x0 ???:?:?: 0x7ff746677912 in ??? (bun.exe) ???:?:?: 0x7ff746edad31 in ??? (bun.exe) ???:?:?: 0x7fff014f9332 in ??? (ucrtbase.dll) ???:?:?: 0x7fff02d4257c in ??? (KERNEL32.DLL) ???:?:?: 0x7fff03b0aa47 in ??? (ntdll.dll)

Segmentation fault at address 0x0 ???:?:?: 0x7ff746677912 in ??? (bun.exe) ???:?:?: 0x7ff746edad31 in ??? (bun.exe) ???:?:?: 0x7fff014f9332 in ??? (ucrtbase.dll) ???:?:?: 0x7fff02d4257c in ??? (KERNEL32.DLL) ???:?:?: 0x7fff03b0aa47 in ??? (ntdll.dll)

Segmentation fault at address 0x0 ???:?:?: 0x7ff746677912 in ??? (bun.exe) ???:?:?: 0x7ff746edad31 in ??? (bun.exe) ???:?:?: 0x7fff014f9332 in ??? (ucrtbase.dll) ???:?:?: 0x7fff02d4257c in ??? (KERNEL32.DLL) ???:?:?: 0x7fff03b0aa47 in ??? (ntdll.dll)

Additional information

No response

Electroid commented 5 months ago

Could you share the code you're running?

duckytutorials commented 5 months ago
const express = require('express')
const bodyParser = require('body-parser')
const cookieParser = require('cookie-parser')
const session = require('express-session')
import { env } from 'bun';
import chalk from 'chalk';
const path = require('path')
const fs = require('fs')
const MongoStore = require('connect-mongo');
const fileUpload = require('express-fileupload')
const livereload = require("livereload");
const connectLiveReload = require("connect-livereload");
const PORT = process.env.PORT || 3341 // Uselessness of packages
/* ==== Pulled from https://stackoverflow.com/questions/11744975/enabling-https-on-express-js ==== */
var http = require('http');
var https = require('https');
var privateKey  = fs.readFileSync('webcert/ssl.key', 'utf8');
var certificate = fs.readFileSync('webcert/ssl.crt', 'utf8');
var credentials  = {
  key: privateKey,
  cert: certificate
}; // WANT FUCKING HTTPS???
/* ======== */
const app = express() // You need this, Else you'd be fucked

require('./utilities/FortKNOX')

const liveReloadServer = livereload.createServer();
liveReloadServer.server.once("connection", () => {
  setTimeout(() => {
    liveReloadServer.refresh("/");
  }, 100);
});
app.use(connectLiveReload());
app.use(require('cors')())
app.set("view engine", require('ejs'))
app.use(cookieParser());
app.use(session({
  secret: process.env.session_sercret, // Leaky Leaky
  resave: true,
  saveUninitialized: false,
  store: MongoStore.create({ mongoUrl: process.env.mongoose }) // Store Sessions For Hijacking hehehe
}));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());
app.use(fileUpload({
  useTempFiles : true,
  tempFileDir : './temp'
})); // Never even got to use this
app.use("/api", require('./routers/api')) // Peak ducky
app.use("", require('./routers/index')) // For / Route 
app.use('/assets', express.static(path.join(__dirname, 'assets')))
app.use('/node_modules', express.static(path.join(__dirname, 'node_modules'))) // Nice security vuln's
// That would't work
// app.use('/api/user', express.static(path.join(__dirname, 'avatars')))
// 

// Testing Section!!!!$

// Note All The Tests
// Custom Domains
  // const cds = require('./nginx/index')
  // console.log( await cds.proxyDomain("gitlab.novabot.gg", "192.168.1.11", "32769")) // Finally works! Heheheheh
  // ^ That took 3 hours

// Testing Section!!!!#

// Handlers
require('./cronjobs/listener') // Listen for my screams of aggony
require('./mongoose/init')
require('./utilities/updater.js') // Update the broken code | Spoiler: it doesn't work
if (fs.existsSync('updating.env')) {
  fs.rename('updating.env', '.env', () => { 
    console.log("\n Update Finished! If Settings are broken contact support! \n"); // Update finished, I wanna die.
  }); 
}

app.use((req, res, next) => {
  res.status(404).render(__dirname+'/views/errors/duckrender404.ejs', {

  })
}) // 404 Duck not found

// HTTP(s) Configurations
var httpServer = http.createServer(app);
var httpsServer = https.createServer(credentials, app); // i should delete

/*
httpServer.listen(3341, () => {
  console.log(chalk.blue("[EXPRESS]") + chalk.green("HTTP WS Running on port:", 3341))
});
httpsServer.listen(3342, () => {
  console.log(chalk.blue("[EXPRESS]") + chalk.green("HTTP(S) WS Running on port:", 3342))
});
*/
// decided https is fucked 

app.listen(3341, () => {
  console.log(chalk.blue("[EXPRESS]") + chalk.green("HTTP WS Running on port:", 3341))
})
duckytutorials commented 5 months ago

its with any project running ExpressJS on request! Maybe its a NT issue? Lke ram isolation or core isolation idk

duckytutorials commented 5 months ago

It crashes first run, second run doesn't then it crashes again

garryspins commented 5 months ago

Encountering the same issue, on canary

duckytutorials commented 5 months ago

Encountering the same issue, on canary

yeah i think its a ram allowcation issue?

garryspins commented 5 months ago

I didnt do much testing, i was on --hot so i assume its something to do with that.

CuteNikki commented 5 months ago

image Just got this error (which seems pretty similar) when starting my discord bot. Tried starting it again it was fine on the second try.

duckytutorials commented 5 months ago

I didnt do much testing, i was on --hot so i assume its something to do with that.

I was running on just bun

duckytutorials commented 5 months ago

image Just got this error (which seems pretty similar) when starting my discord bot. Tried starting it again it was fine on the second try.

Yes, same as mine but the ram hexadecimal location is 0x0

CuteNikki commented 5 months ago

I didnt do much testing, i was on --hot so i assume its something to do with that.

I was running on just bun

Same

CuteNikki commented 5 months ago

Also want to mention that this has never happened to me on Bun 1.0 This has only happened on Bun 1.1 and I was using it on Windows 11 (without having WSL installed)

duckytutorials commented 5 months ago

Also want to mention that this has never happened to me on Bun 1.0 This has only happened on Bun 1.1 and I was using it on Windows 11

Yes

okhy commented 4 months ago

Hello, we're facing the same issue on Windows machines - any update on resolution?

CuteNikki commented 4 months ago

It's gotten so bad I sometimes restart my project 5 times before getting it to work once.

plashenkov commented 3 months ago

I have the same error when running bunx nuxt build on a 1 GB RAM VDS. Bun is running in the oven/bun:1.1.10-alpine container. The Nuxt app is empty, based on the default, stock template. I experience full RAM and CPU load on the VDS, all services hang for tens of minutes.

Node.js does the job, by the way.

See the picture from bottom to top. There were no code changes that directly affected the build (just unimportant, unrelated fixes)

image

github-actions[bot] commented 1 month ago

This issue is stale and may be closed due to inactivity. If you're still running into this, please leave a comment.

duckytutorials commented 1 month ago

mhm im still running into this