Closed scffs closed 1 month ago
Any chance you could provide some code for us to reproduce the issue? The crash is saying that it is something to do with the HTTP client. But it's hard to assess further than that.
Any chance you could provide some code for us to reproduce the issue? The crash is saying that it is something to do with the HTTP client. But it's hard to assess further than that.
yes sure
import { connect } from 'mongoose'
const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
const connectToDatabase = async () => {
try {
await connect('mongodb://localhost:27017/test')
} catch (error) {
process.exit(1)
}
}
export const getSmth = async () =>
fetcher('https://jsonplaceholder.typicode.com/posts')
const fetcher = async (url, body = '{}') => {
let items
const response = await fetch(url, {
method: 'POST',
headers: {
Authorization: '123',
'Content-Type': 'application/json'
},
body
}).catch((error) => {
console.error(`Error (${new Date().toISOString()}): ${error}`)
})
try {
const r = await response.json()
// IDK why there is no return but it works
if (response.status !== 200) {
console.error(r)
}
console.log('r', r)
items = r
} catch (err) {
return null
}
await delay(450)
return items
}
// a simplified version of my code
async function main() {
// could comment this I guess
await connectToDatabase()
// I'm getting some data to display it in the console
const someData = await getSmth()
while (true) {
const newInterval = 1000
try {
await getSmth()
} catch (error) {
console.error(error)
}
// in my case, I get an array of some elements and in a loop I run a different query for each of these elements
for (let i = 0; i < 10; i++) {
await getSmth()
}
await getSmth()
await delay(newInterval)
}
}
main()
@Jarred-Sumner, hi again
According to my observations, the script really crashes after the screen is locked or during somehow
by the way, I have 2 identical scripts running (let's imagine that I have 2 identical projects in different folders and work independently of each other) and as a rule only 1 crashes
Can you still reproduces it on v0.0.20
? This looks like a issue that is already solved
Can you still reproduces it on
v0.0.20
? This looks like a issue that is already solved
I'll check this today
looks like fixed
but can you please provide any information? like PR that fixed this bug or whatever
@cirospaciari
I got this error again xd @cirospaciari
We added some fixes into sockets, can you try bun upgrade --canary
and check if is still happening?
fixed at 1.1.24
How can we reproduce the crash?
I wrote a simple code that only make requests to server in a while. It is possible that the crash is in PC lock mode (Control-Command-Q)
Relevant log output
Stack Trace (bun.report)
Bun v1.1.13 (
bd6a605
) on macos aarch64 [RunCommand]Segmentation fault at address 0x48C00F23C80
src.http.onWritable__anon_482057
src.deps.uws.NewSocketHandler
us_loop_run_bun_tick
src.http.HTTPThread.processEvents
Thread.PosixThreadImpl.spawn__anon_292305.Instance.entryFn
in the 1.1.12 version of bun this code works fine (all day without crashing)