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

bun crashes on "long" (recursive) iterations #15254

Open
Tomato6966 opened this issue Nov 19, 2024 · 2 comments
Open

bun crashes on "long" (recursive) iterations #15254

Tomato6966 opened this issue Nov 19, 2024 · 2 comments
Labels
bug Something isn't working node:process

Comments

@Tomato6966
Copy link

Tomato6966 commented Nov 19, 2024

What version of Bun is running?

1.1.34+5e5e7c60f

What platform is your computer?

5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64

What steps can reproduce the bug?

When running a file.ts which scans readdir("path", { recursive }) and then map over all result strings to add the "path" infront, bun doesn't complete the map

import { readdir } from "node:fs/promises";

export const walks = async (path:string, recursive = true):Promise<string[]> => {
    let files = [];
    const items = await readdir(path, { withFileTypes: true });
    if(!items) throw new Error(`No items in ${path}`);
    for (let i = 0, m = items.length; i < m; ++i) {
        if(items[i].isDirectory()) {
            if (recursive) files = [ ...files, ...(await walks(`${path}/${items[i].name}`)) ]
        } else if(items[i].isFile()) {
            files.push(`${path}/${items[i].name}`)
        }
    }
    return files;
};

I'm on ubuntu 22 via wsl

What is the expected behavior?

No response

What do you see instead?

No response

Additional information

No response

@Tomato6966 Tomato6966 added bug Something isn't working needs triage labels Nov 19, 2024
@Tomato6966
Copy link
Author

Tomato6966 commented Nov 19, 2024

It's because when i initialize those ELs:

    process.on('SIGINT', () => process.exit());
    process.on('SIGUSR1', () => process.exit());
    process.on('SIGUSR2', () => process.exit());

It seems like it's only because of this: SIGUSR1

@Jarred-Sumner
Copy link
Collaborator

We probably need to disable SIGUSR1. SIGUSR1 is used by the GC to signal collection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working node:process
Projects
None yet
Development

No branches or pull requests

3 participants