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

Unexpected Process Termination in Bun 1.1.36 While Requesting Multiple URLs with Axios #15361

Open
k3341095 opened this issue Nov 23, 2024 · 0 comments
Labels
bug Something isn't working needs investigate Needs to be investigated to find the root cause

Comments

@k3341095
Copy link

k3341095 commented Nov 23, 2024

What version of Bun is running?

1.1.36

What platform is your computer?

windows 11 x64

What steps can reproduce the bug?

As a passionate supporter of Bun, I hope these issues can be resolved quickly, as I have a high-demand project waiting to proceed. Below are the two main problems I’ve encountered:


When using Bun version 1.1.34 with the latest version of Axios, certain URLs caused the process to hang indefinitely. This issue ignored try-catch blocks and timeout settings, and the process would neither exit nor throw any error. It behaved like an infinite loop.

Upon upgrading to Bun 1.1.36, the original issue was resolved. However, a new problem emerged. While making requests to multiple URLs using a for loop, the process terminates randomly without any errors or warnings. For example, it might terminate after the 3rd request, the 10th request, or at other seemingly random iterations. The issue persists even when wrapped in try-catch blocks.

When building a project using Bun 1.1.36 for Node.js execution, the resulting build fails to run due to the following error:

  safer.Buffer.prototype = Buffer2.prototype;
                                   ^

TypeError: Cannot read properties of undefined (reading 'prototype')

This issue occurs specifically when using Axios with the responseType: "arraybuffer" option in the request configuration.

As a workaround, modifying the source code to make it compatible with Node.js resolves the issue, and testing directly in Node.js works as expected without any errors. This indicates that the problem lies in Bun's build process rather than the source code itself.

Please also review #15131 again. I’ve added images for reference.

What is the expected behavior?

The process should complete all HTTP requests and log any errors in the catch block if a request fails.

What do you see instead?

The process terminates randomly during the for loop, without any error or exception being thrown.

Additional information

The previous issue with Bun 1.1.34 (indefinite process hang) was resolved after the upgrade.
The termination seems to occur at random iterations of the for loop and does not provide any clues or error messages.
The problem seems related to how Bun handles the responseType: "arraybuffer" configuration during the build process.

@k3341095 k3341095 added bug Something isn't working needs triage labels Nov 23, 2024
@RiskyMH RiskyMH added needs investigate Needs to be investigated to find the root cause and removed needs triage labels Nov 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigate Needs to be investigated to find the root cause
Projects
None yet
Development

No branches or pull requests

2 participants