oven-sh / bun

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

Some nodemon issue #10991

Closed yaquenj closed 2 months ago

yaquenj commented 5 months ago

How can we reproduce the crash?

No response

JavaScript/TypeScript code that reproduces the crash?

################## ./classes/client ##################
import { Client, Partials, IntentsBitField, ActivityType } from 'discord.js';

export default class DiscordClient extends Client {
    constructor() {
        super (
            {
                partials: [Partials.Channel, Partials.GuildMember, Partials.GuildScheduledEvent, Partials.Message, Partials.Reaction, Partials.ThreadMember, Partials.User],
                intents: [IntentsBitField.Flags.AutoModerationConfiguration, IntentsBitField.Flags.AutoModerationExecution, IntentsBitField.Flags.DirectMessageReactions, IntentsBitField.Flags.DirectMessageTyping, IntentsBitField.Flags.DirectMessages, IntentsBitField.Flags.GuildEmojisAndStickers, IntentsBitField.Flags.GuildEmojisAndStickers, IntentsBitField.Flags.GuildIntegrations, IntentsBitField.Flags.GuildInvites, IntentsBitField.Flags.GuildMembers, IntentsBitField.Flags.GuildMessageReactions, IntentsBitField.Flags.GuildMessageTyping, IntentsBitField.Flags.GuildMessages, IntentsBitField.Flags.GuildModeration, IntentsBitField.Flags.GuildPresences, IntentsBitField.Flags.GuildScheduledEvents, IntentsBitField.Flags.GuildVoiceStates, IntentsBitField.Flags.GuildWebhooks, IntentsBitField.Flags.Guilds, IntentsBitField.Flags.MessageContent],
                presence: {
                    afk: false,
                    status: "dnd",
                    activities: [
                        {
                            type: ActivityType.Watching,
                            name: "QuietMolly Casino"
                        }
                    ]
                }
            }
        )
    }
}
######################################################

###################### bot.ts ########################

//! ↓ Imports ↓

import DiscordClient from './classes/client';
import { runDB, ticket, user, world, items } from './utils/mongo';
import config from './data/config';
import fs from 'fs';
import path from 'path';

//! ↓ Create the bot client ↓
const client = new DiscordClient();

client.login(config.token);

//! ↓ Run the database ↓
runDB(config.mongoUri);
const db = { user, world, ticket, items }

//! ↓ Event Handler ↓

// ? ↓ Loads all the events in the events folder. ↓     

const events: string[] = fs.readdirSync(path.join(__dirname + '/events'));
console.info("Loaded " + events.length + " Events");

//? ↓ Runs all of the events in the events folder. ↓        
events.forEach(async event => {

    const ev = await require("./events/" + event);

    //? ↓ Runs the event depending on the type (once / on) ↓
    if (ev.default.once) client.once(ev.default.name, (...args) => ev.default.run(client, db, ...args))
    else client.on(ev.default.name, (...args) => ev.default.run(client, db, ...args));

});

//! ↓ Application AntiCrash ↓

process.on('unhandledRejection', console.error);
process.on('uncaughtException', console.error);

Relevant log output

[nodemon] starting `bun run ./bot.ts .`
Loaded 4 Events
============================================================
Bun v1.1.6-canary.1 (84d81c30) Windows x64
Args: "bun", "run", "./bot.ts", "."
Features: Bun.stdin(2) fetch transpiler_cache(10) tsconfig(6) WebSocket 
Builtins: "bun:main" "node:assert" "node:buffer" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:net" "node:os" "node:path" "node:stream" "node:string_decoder" "node:timers" "node:timers/promises" "node:tls" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib" "node:worker_threads" "undici" "ws" 
Elapsed: 1286ms | User: 234ms | Sys: 62ms
RSS: 0.29GB | Peak: 0.30GB | Commit: 0.36GB | Faults: 73844

panic(main thread): Segmentation fault at address 0xFFFFFFFFFFFFFFFF
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.1.6/wr184d81c3AkghgwK+lh+0CuusvvC8+3ge49w9dgju9dkj+wG29x0uC44roF02ipF432tFA2DD

[nodemon] app crashed - waiting for file changes before starting...

Stack Trace (bun.report)

Bun v1.1.6 (84d81c3) on windows x86_64 [RunCommand]

Segmentation fault at address 0xFFFFFFFFFFFFFFFF

Features: Bun.stdin, fetch, transpiler_cache, tsconfig, WebSocket

cirospaciari commented 2 months ago

Fixed in canary v1.1.22 if is happening after bun upgrade --canary feel free to reopen