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.connect footgun #156

Open
dlants opened this issue Dec 30, 2024 · 2 comments
Open

Bun.connect footgun #156

dlants opened this issue Dec 30, 2024 · 2 comments

Comments

@dlants
Copy link

dlants commented Dec 30, 2024

Hi wallpants! Thanks so much for the work here, I found it really useful in getting started on https://github.com/dlants/magenta.nvim

I am running into an issue. I think it's probably neovim, and not bunvim, but I wanted to maybe get your input on how to go about debugging it. I documented the issue here: neovim/neovim#31793

Would appreciate any ideas you might have about how to debug this.

Thanks!

@dlants
Copy link
Author

dlants commented Dec 31, 2024

Ah turns out it is probably a bun thing, not a neovim thing:

oven-sh/bun#16076

@dlants dlants changed the title help debugging rpc issue? Bun.connect footgun Dec 31, 2024
@dlants
Copy link
Author

dlants commented Dec 31, 2024

Ah, it turns out it actually is an issue with this plugin:

https://github.com/wallpants/bunvim/blob/main/src/attach.ts#L44

See this comment: oven-sh/bun#16076 (comment)

socket.write returns the number of bytes written and doesn't buffer. That means if you write a large amount of data, the network might not send all of it, and you have to retry the unsent data when the drain callback is called. This buffering behavior is how it works in the system APIs on posix/windows.

This is very much a footgun, and we need to make this clearer in the documentation or have a way to buffer this automatically (outside of using node:net), because you're not the first person who thought this was a bug.

dlants added a commit to dlants/bunvim that referenced this issue Dec 31, 2024
also add some tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant