-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Ip-location-api updatedb.mjs broken as of bun 1.2.0 #18662
Comments
Seems to fail in Notes
Around
|
Try replacing Buffer.allocUnsafe() with Buffer.alloc(). This will zero-fill memory to determine if it is a memory handling issue: buffer= buffer.alloc(4) |
@Fendaril just tried your suggestion, replaced each of the |
Try this to see exactly where logs stop.
If logs stop before writing buffers, then something is breaking before buffer allocation. If logs stop after .pause() but before .resume(), then Bun 1.2+ isn’t handling backpressure correctly. |
It fails writing the buffer on 1.2.7 and logs 516, on 1.1.45 it never logs that line
|
Since the log only appears in Bun 1.2.7 and not in 1.1.45 it could signal that that Bun 1.2+ changed handling of backpressure, which causes the internal buffer stream ws1 to reach it's internal limit faster. The reason why it is pausing for 5-6 seconds and exiting silently could be because ws1.write() is returning false because the stream is overwhelmed. This means that rs.pause() is called but never resumed. Here are some things that you can try: Manually resume on drain: currently, the script pauses but never resumes when the stream is prepared: Try listening for the drain event so you can resume the stream
You could also try increasing the readable buffer size:
Since the default highWaterMark is 16KB for writable streams increasing it will reduce backpressure occurrences. |
@JasonTJames It already has handling for |
@JasonTJames nice call on |
What version of Bun is running?
1.2.7+5c0fa6dc2
What platform is your computer?
Linux 5.15.167.4-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
Upgrading from 1.1.38 to 1.2.0+ causes the following to change bahvour
It seems to cause it to exit/crash part way through processing, which can be seen below in the 1.1 vs 1.2 examples, where 1.2 is missing "Database update completed!!"
What is the expected behavior?
Bun 1.1.38 - 1.1.45
What do you see instead?
Bun 1.2.0 - 1.2.7
Additional information
Have tested on all versions from 1.1.38 - 1.2.7 and it changes at 1.2.0.
Haven't yet dug deeper into the root cause, but would assume its byte/stream related during the processing of csv's to a optimized .dat version
The text was updated successfully, but these errors were encountered: