oven-sh / bun

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

Segmentation fault (core dumped) #8448

Closed Calemy closed 6 months ago

Calemy commented 9 months ago

What version of Bun is running?

1.0.25+a8ff7be64

What platform is your computer?

Linux 5.15.0-89-generic x86_64 x86_64

What steps can reproduce the bug?

import { Elysia, t } from 'elysia'
import { swagger } from '@elysiajs/swagger'
import { MeiliSearch } from "meilisearch"

const database = new MeiliSearch({
    host: "127.0.0.1",
    apiKey: "yourDatabaseKey"
})

const app = new Elysia().use(swagger())

app.get('/d/:id', async ({ set, params }) => {

const search = (await database.index("beatmaps").search("", {
    filter: `id = ${params.id}`
})).hits[0]

const file = Bun.file(`./anyfile.txt`)
return new Response(file.stream()); //return new Response(file); doesn't work either

}), {
    params: t.Object({
        id: t.Numeric()
    })
}
app.listen(4005)

What is the expected behavior?

to keep working after the request has been processed

What do you see instead?

Segmentation fault (core dumped)

Additional information

I've observed it's only in the mix of using the database and the file handling

ardauzan commented 9 months ago

I have the same problem with elysia and pg. It seems to run without crashing on 1.0.11 but on 1.0.25 it does crash. As a temporary solution you could roll back to an older version of bun (1.0.11 is arbitrary and I didn't test any other versions) Im on fedora 39, with kernel 6.6.13-200.fc39.x86_64

Jarred-Sumner commented 9 months ago

It's something to do with new Response(Bun.file()) but haven't narrowed it down yet.

f4yis commented 9 months ago

Had the same issue with Elysia and static file serving. Updating bun to the latest version 1.0.25 ( was on 1.0.21 ) solves the problem

ardauzan commented 9 months ago

Had the same issue with Elysia and static file serving. Updating bun to the latest version 1.0.25 ( was on 1.0.21 ) solves the problem

I had the issue on 1.0.25 and rolled back to 1.0.24 which fixed it, but I will try again with 1.0.25

Calemy commented 9 months ago

1.0.24 works for me aswell but 1.0.25 just causes the entire issue. i don't know what happened there

Calemy commented 6 months ago

seems to be fixed on version 1.1.4 so i'm closing this issue.