-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
:pipe hangs when piping a large file through sed #3127
Comments
I'm pretty sure the problem is that helix/helix-term/src/commands.rs Lines 4429 to 4433 in 76756f0
takes a byte slice for input , which in this case is the whole file. This means that the internal rope has to be copied completely. shell_impl should probably take impl Iterator<&[u8]> or something similar.
|
I don't think that's the problem. Firstly copying ~7000 lines shouldn't take that long, but secondly it freezes indefinitely and the CPU usage of the helix process goes to 0%, so I don't think this is a performance problem, I think this is some kind of deadlock... |
I was able to reproduce this with |
As an aside, copying the rope in |
Oh, didn't read that in time. I already fixed it in a different way (I think this should solve it), but making this async and using |
Checked and didn't solve it :( |
You can use |
I think ultimately this needs to be "real" async or at least multithreaded, since we probably need to write to stdin and poll stdout at the same time. I think that's what causing this issue. I spent some hours trying to get it to work, but it didn't work out :) |
Like |
There is #3029 |
That looks nice. Some pieces are missing to fix this e.g. we actually need to spawn a new task so execution is actually multithreaded, but it's a start.
|
After more experimentation I managed to get a working version of this, but it seems writing to Intuitively there has to be another solution since we're blocking on the threads execution, so we don't give away any references. But I don't see a way to tell that to the borrow checker other then with |
I think that's fine, you can clone the rope + selection and move them into the async closure. Cloning a rope is a shallow copy (essentially cloning an Arc internally), it will reuse the same tree and only start diverging as changes are made to the rope. The structure is immutable |
Ah ok, thanks! Gonna open a PR then. |
Summary
Helix freezes and becomes unresponsive when piping a large (~7600 lines) file into
sed
. Piping the same file intosed
outside of helix doesn't produce the same behavior, and helix seems to handle piping smaller files just fine. Piping into other commands also doesn't seem to cause the same issue though I didn't try very many.Reproduction Steps
I tried this:
hx frankenstein.txt
(from here)%
|sed s/l/w/g
I expected this to happen:
The command to execute and all of the 'l' characters in Frankenstein to be replaced with 'w'
Instead, this happened:
Helix became unresponsive
Helix log
~/.cache/helix/helix.log
Platform
Linux (Pop!_Os)
Terminal Emulator
Alactritty v0.10.0-rc1
Helix Version
helix 22.05 (5ed6223)
The text was updated successfully, but these errors were encountered: