bun icon indicating copy to clipboard operation
bun copied to clipboard

Segmentation Fault

Open spartacus04 opened this issue 9 months ago • 0 comments

How can we reproduce the crash?

Consistently happens when running the code, I assume because a request times out since it happens around the 120 seconds mark.

JavaScript/TypeScript code that reproduces the crash?

// @ts-ignore
import { executeInThread } from 'funthreads';

const timeLimit = 120000;

const proxyEndPoint = 'https://api.proxyscrape.com/v3/free-proxy-list/get?request=displayproxies&protocol=http&proxy_format=protocolipport&format=text&timeout=10000';

const initProxies = async () => {
    const data = await fetch(proxyEndPoint);

    const proxies = (await data.text()).split('\r\n').filter(proxy => proxy != '');

    const results = await Promise.all(proxies.map(async (proxy) => {
        return await executeInThread(async (url : string, timeLimit : number) => await new Promise(async (resolve) => {
            console.log('Checking proxy:', url);

            const start = Date.now();

            const cancel = setTimeout(() => {
                resolve({ url, statusCode: 400, timeout: 10000 });
            }, timeLimit)

            const statusCode = await fetch(
                "https://api.ipify.org",
                {
                    proxy: url,
                }
            ).then(res => res.status).catch(() => 400);
            
            clearTimeout(cancel);

            const end = Date.now();
            const timeout = end - start;
            
            console.log('Checked proxy:', url, 'Status code:', statusCode, 'Timeout:', timeout);

            resolve({ url, statusCode, timeout });
        }), proxy, timeLimit);
    }));
}


initProxies();

Relevant log output

Bun v1.1.9 (bb13798d) Linux x64
Args: "/home/andrea/.local/share/pnpm/global/5/node_modules/bun/bin/bun", "run", "src/proxy.ts"
Features: jsc fetch(803) tsconfig 
Builtins: "bun:main" "node:path" "node:worker_threads" 
Elapsed: 120708ms | User: 34645ms | Sys: 113954ms
RSS: 10.83GB | Peak: 2.57GB | Commit: 10.83GB | Faults: 0

panic: Segmentation fault at address 0x6EA0
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.9/lr1bb13798AigiggE2srujE+40Qy19lBA2Agq3B

Illegal instruction (core dumped)

Stack Trace (bun.report)

Bun v1.1.9 (bb13798) on linux x86_64 [RunCommand]

Segmentation fault at address 0x00006EA0

spartacus04 avatar May 23 '24 15:05 spartacus04