marlonrichert / zsh-autocomplete

🤖 Real-time type-ahead completion for Zsh. Asynchronous find-as-you-type autocompletion.
MIT License
5.02k stars 143 forks source link

crash when press arrow up key #645

Open GuannanHu opened 9 months ago

GuannanHu commented 9 months ago

To reproduce, first, input something that doesn't match anything in current folder , say, cd../bash; or cd sdfdsfsf; or nvim ssfs; then press the arrow up key twice, the zsh crashes with the following message printed in the terminal. free(): corrupted unsorted chunks or corrupted double-linked list or malloc(): unaligned tcache chunk detected

Warning: Program '/bin/zsh' crashed.

Normally the color of the text of the command changes and it won't prompt anything.

I tried this on another machine with the same setup. Konsole won't crash it is stuck at loading, I have to ctrl+c to stop it.

Environment

% typeset -p1 VENDOR OSTYPE ZSH_PATCHLEVEL _autocomplete__funcfiletrace

typeset VENDOR=pc typeset OSTYPE=linux-gnu typeset ZSH_PATCHLEVEL=zsh-5.9-0-g73d3173 typeset -a _autocomplete__funcfiletrace=( /usr/share/zsh/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4 /usr/share/zsh/manjaro-zsh-prompt:6 /usr/share/zsh/manjaro-zsh-prompt:1 /home/mjan/.zshrc:9 zsh:0 )

.zshrc

# Use powerline
USE_POWERLINE="true"
# Source manjaro-zsh-configuration
if [[ -e /usr/share/zsh/manjaro-zsh-config ]]; then
  source /usr/share/zsh/manjaro-zsh-config
fi
# Use manjaro zsh prompt
if [[ -e /usr/share/zsh/manjaro-zsh-prompt ]]; then
  source /usr/share/zsh/manjaro-zsh-prompt
fi
SirenityK commented 9 months ago

Try to roll-back to 2023-05-24 release for now until it is fixed; I am not finding (for now) that problem in this version. I am concerned that you posted this 8 days ago and nobody even noticed, rolling-back apparently gets rid of this bug.

GittyMac commented 9 months ago

Sadly the previous version doesn't seem to work with zsh 5.9, just leaving a line of command not found errors in any cases of recursive calls.

fshuva commented 8 months ago

I have experienced the same issue. I can reproduce this intermittently with any failed zsh command, like an invalid program name, etc. Using invalid cd commands, like the OP, can reproduce this issue reliably.

typeset VENDOR=ubuntu
typeset OSTYPE=linux-gnu
typeset ZSH_PATCHLEVEL=ubuntu/5.8.1-1
typeset -a _autocomplete__funcfiletrace=(
/home/fshuva/.oh-my-zsh/custom/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh:4
/home/fshuva/.oh-my-zsh/oh-my-zsh.sh:179
/home/fshuva/.oh-my-zsh/oh-my-zsh.sh:208
/home/fshuva/.zshrc:122
zsh:0
)

Terminal: GNOME Terminal

.zshrc

if [[ -r "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" ]]; then source "${XDG_CACHE_HOME:-$HOME/.cache}/p10k-instant-prompt-${(%):-%n}.zsh" fi bindkey '^ ' autosuggest-accept plugins=(git tmux zsh-autosuggestions zsh-syntax-highlighting zsh-autocomplete ) source $ZSH/oh-my-zsh.sh autoload -U compinit; compinit [ -f ~/.fzf.zsh ] && source ~/.fzf.zsh export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'

CheatCod commented 8 months ago

I am having the same issue on m2 MacBook pro zsh 5.9 (x86_64-apple-darwin23.0). Pressing up after a command has failed freezes the shell with the cursor blinking and zsh taking 100% of CPU.

Aftering ctrl-c it gives this:

zsh(22992,0x1e12f5300) malloc: Incorrect checksum for freed object 0x12a814000: probably modified after being freed.
Corrupt value: 0x600002b3e200
zsh(22992,0x1e12f5300) malloc: *** set a breakpoint in malloc_error_break to debug
sunnyayyl commented 8 months ago

The same is happening on my fedora. Steps:

  1. dnf provides chsh
  2. Press up arrow
  3. Crash

gdb crash log (not sure if I'm using this right) Program received signal SIGSEGV, Segmentation fault.
0x00007fffea576a08 in singledraw ()user
at /usr/src/debug/zsh-5.9-7.fc38.x86_64/Src/Zle/complist.c:1953

CheatCod commented 8 months ago

It seems like the issue is fixed on zsh 5.9 m2 macbook pro if you revert to commit 3942311, still hoping for a proper fix though.

kud commented 8 months ago

Got the same issue yeah. I had to disable the plugin as it breaks my shell for now.

0xluc commented 8 months ago

Same here, when I cd into a folder inside my Downloads folder and I press the up key, it crashes: 20Afree(): corrupted unsorted chunks

ZA0068 commented 8 months ago

I get this crash issue too on both my terminal and my terminator

ZA0068 commented 8 months ago

Click on the window you want to change the opacity for ╭─free(): corrupted unsorted chunks················░▒▓ ✔  at 16:18:49  ─╮ [1] 32937 IOT instruction (core dumped) zsh

CarolineMorton commented 8 months ago

Same issue here. On a M2 and it causes a crash, with my CPU usages shooting up to 97% with zsh. The fan even came on!

julien-blanchon commented 8 months ago

This is pretty annoying :(

Luk9091 commented 8 months ago

A simple solution that works for me. I did comment out lines 61 to 67 in the file Completions/_autocomplete__history_lines

   60 local -P groups="${(l:$(( 2 * $#words[CURRENT] ))::=0:):-}"
   61 # _comp_colors=( # ERROR
   62 # "=(#b)${numpat}${lbuffer}(${query})${rbuffer}${rbuffer:+[[:blank:]]#}=2=2=0=0=30; 103$groups"
   63 # "=(#b)${numpat}${lbuffer}(${query})*=2=2=0=30;103$groups"
   64 # "=(#b)${numpat}${lbuffer}(*)=2=2=0"
   65 # "=(#b)${numpat}*=0=2"
   66 # ${(M)_comp_colors:#ma=*}
   67 # )

Nagranie ekranu z 2023-11-08 01-01-48.webm

julien-blanchon commented 8 months ago

Thanks @Luk9091 ! I think the history should be disable for now, this is breaking almost all my installation. Both macOS and Ubuntu

joo920131 commented 8 months ago

I get similar issue like this where it just gets stuck 😭

https://github.com/marlonrichert/zsh-autocomplete/assets/42609860/2d23ac6a-ebfc-4acf-85f5-dd5fffef0856

ingorichter commented 7 months ago

@joo920131 I see the same issue on my M1 machine with zsh 5.9 :-/

lockieluke commented 7 months ago

anyone know if rolling back to an older version works?

AustinColby commented 7 months ago

anyone know if rolling back to an older version works?

Yes, I rolled back to the previous release (https://github.com/marlonrichert/zsh-autocomplete/releases/tag/23.05.24), and I no longer have the issue on both Linux and macOS.

tsumarios commented 6 months ago

This is annoying. It also happens to Fedora 39.

imreallyliam commented 6 months ago

Experiencing this issue on Debian 11 and MacOS (M2, latest OS)

0xl30 commented 6 months ago

Same Issue When Click Arrow Key Terminal Crashed...(Some Time) Arch Linux 6.6.10 zsh 5.9

ChloeColman commented 5 months ago

Same here trying to complete non existing paths Arch Linux 6.7.0-zen3-1-zen zsh 5.9 (x86_64-pc-linux-gnu)

edte commented 4 months ago

same question

weberam2 commented 4 months ago

I put this at the bottom of my .zshrc

source ~/.oh-my-zsh/custom/plugins/zsh-autocomplete/zsh-autocomplete.plugin.zsh

which seems to have fixed it for me

t40mas commented 4 months ago

Hopefully, i will give it a try.

t40mas commented 4 months ago

Hopefully, i will give it a try.

Nope, unfortunately it's not working for me.

lukaskretzschmer commented 4 months ago

Finally, I have been having this issue since I updated and the error happens so fast that you can barely see what it says but it basically a free() error, unsupported chunks, double link something and this happens most of the times when using arrow keys on the history. IMPORTANT If you use tmux the terminal will just hang there when pressing the arrows keys on the history, I thought tmux was the issue, but with a gnome terminal with zsh I could finally see these errors. And no, I can roll back because of compatibility issues. But I think it might something about freeing an already "freed" pointer. I am not that good at C.

lukaskretzschmer commented 4 months ago

Finally, I have been having this issue since I updated and the error happens so fast that you can barely see what it says but it basically a free() error, unsupported chunks, double link something and this happens most of the times when using arrow keys on the history. IMPORTANT If you use tmux the terminal will just hang there when pressing the arrows keys on the history, I thought tmux was the issue, but with a gnome terminal with zsh I could finally see these errors. And no, I can roll back because of compatibility issues. But I think it might something about freeing an already "freed" pointer. I am not that good at C.

It was a hard issue to find on the internet.

samscientist commented 1 month ago

Until now, I faced the same problem, and not sure exactly why, but it seems to be solved when the plugin is installed by 'Znap', the Zsh plugin manager the repo owner recommended to use in the README.

marlonrichert commented 1 month ago

I just pushed in a new version. Can you try if the problem still occurs?

4brunu commented 1 day ago

@marlonrichert could you please create a new tag so that I can install the new version using homebrew and test the new version? thanks

joo920131 commented 1 day ago

I just pushed in a new version. Can you try if the problem still occurs?

Thank you @marlonrichert ! I'll have a play around and see if this issue is resolved for me