You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using the above test code, the problem continues (on v0.6.14 ~ v1.0.7)
import{writeFileSync}from"node:fs";import{file}from"bun";writeFileSync("./example.txt","this is an example file");console.log(awaitfile("./example.txt").text());
this is running on a virtual machine, which failed with an error EBADF :
Linux vm-centos 5.4.119-1-tlinux4-0010.3 #1 SMP Thu Jan 5 17:31:23 CST 2023 x86_64 x86_64 x86_64 GNU/Linux;
the same code runs without error but with ** no output ** in a docker container:
just want to note i have had cases where i've run into EBADF inside docker containers. it's hard to figure out exactly what is going on, but i suspect its from some file descriptor reuse, but it wouldn't explain why it's docker only. also, ive found that most fs functions can repro it if the situation is right, like readFileSync/writeFileSync/etc
does anyone get this issue outside of Docker? my case might be different if this issue happens outside of docker.
using the above test code, the problem continues (on v0.6.14 ~ v1.0.7)
import{writeFileSync}from"node:fs";import{file}from"bun";writeFileSync("./example.txt","this is an example file");console.log(awaitfile("./example.txt").text());
this is running on a virtual machine, which failed with an error EBADF :
Linux vm-centos 5.4.119-1-tlinux4-0010.3 #1 SMP Thu Jan 5 17:31:23 CST 2023 x86_64 x86_64 x86_64 GNU/Linux;
* the same code runs without error but with ** no output ** in a docker container:
Activity
修正: Bun.file(path).text() 工作异常, 使用 Bun.readFile() 代替; oven-sh/bun#1446
Electroid commentedon Nov 10, 2022
robobun commentedon Nov 10, 2022
Electroid commentedon Nov 10, 2022
robobun commentedon Nov 10, 2022
Electroid commentedon Nov 10, 2022
ConProgramming commentedon Jan 19, 2023
Confirming this still is happening on Codespaces instances,
await file("./example.txt").text()robobun commentedon Jan 19, 2023
Jarred-Sumner commentedon Jan 19, 2023
wonder what linux kernel version is being used in Codespaces and if that supports io_uring
terrywh commentedon Feb 17, 2023
on "5.4.119-1-tlinux4-0009-eks #1 SMP Wed Sep 28 23:05:45 CST 2022 x86_64 x86_64 x86_64 GNU/Linux" bun v0.5.6 triggers the same "EBADF" problem
lichenchenisapuppy commentedon Mar 7, 2023
我遇到了同样的问题
bun v0.5.7
linux mint 20.1
试试:
// test.js
console.log(await Bun.readableStreamToText(Bun.file("./test.txt").stream()))
terrywh commentedon Jul 21, 2023
using the above test code, the problem continues (on v0.6.14 ~ v1.0.7)
EBADF:5 remaining items
joshunrau commentedon Sep 27, 2023
I tested this example on Docker and I cannot reproduce. Is it safe to assume this is fixed now?
NoRKin commentedon Sep 28, 2023
Still not working on bun 1.0.3 / Ubuntu 20.04
Tjerk-Haaye-Henricus commentedon Sep 30, 2023
+1 Its happening on a remix app that uses tailwind too.
LoGwi-N commentedon Oct 5, 2023
I have the same problem (
cyr-l commentedon Oct 5, 2023
@LoGwi-N In the meantime,
const text = await Bun.readableStreamToText(file.stream());is working for me.LoGwi-N commentedon Oct 5, 2023
Wonderfull, it's working.
mrGibi commentedon Oct 12, 2023
Same on M1 Mac, inside the
oven/bundocker container running Vite 😔StrongTS commentedon Oct 13, 2023
antoniobergas commentedon Oct 18, 2023
Hi! Not 100% sure if its the right place but I see all Bad file descriptor issue are linked here.
I'm building a CLI with Bun and I read and write into package.json with it.
At running the tests on the pipeline, this Bad file descriptor issue shows up while in local everything works as expected.
After replace Bun.file and Bun.write with the node:fs replacements, local still works and now its working properly in the pipeline also.
Same ubuntu and linux version in local and the agent of the pipeline.
As I said not 100% if its related but it's clear that something it's not working properly with those functions.
Hope this info helps to fix it and thanks for the hard work! 😊
small-angel commentedon Oct 28, 2023
just want to note i have had cases where i've run into EBADF inside docker containers. it's hard to figure out exactly what is going on, but i suspect its from some file descriptor reuse, but it wouldn't explain why it's docker only. also, ive found that most fs functions can repro it if the situation is right, like readFileSync/writeFileSync/etc
does anyone get this issue outside of Docker? my case might be different if this issue happens outside of docker.
terrywh commentedon Nov 1, 2023
@Paperdave i have a vm and a docker container, but with slightly different situation.
eslym commentedon Nov 2, 2023
Same here on digitalocean droplet
Linux 5.4.0-166-generic x86_64 x86_641.0.7+b0393fba6200d8573f3433fb0af258a0e33ac157Same result produced with different users and different file permissions
chicken-suop commentedon Jun 24, 2024
I'm still getting this in
Bun v1.1.16 (Linux x64)withawait file('file.txt').text()running in chokidar watchInfer no Go launch for a command folder named with a backslash (oven-…