zsh-autocomplete icon indicating copy to clipboard operation
zsh-autocomplete copied to clipboard

crash when press arrow up key

Open GuannanHu opened this issue 1 year ago • 33 comments

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 )

  • Terminal emulator: Konsole

.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

GuannanHu avatar Sep 20 '23 02:09 GuannanHu

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.

SirenityK avatar Sep 28 '23 03:09 SirenityK

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.

GittyMac avatar Oct 05 '23 02:10 GittyMac

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'

fshuva avatar Oct 12 '23 07:10 fshuva

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

CheatCod avatar Oct 14 '23 19:10 CheatCod

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

sunnyayyl avatar Oct 16 '23 10:10 sunnyayyl

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.

CheatCod avatar Oct 17 '23 02:10 CheatCod

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

kud avatar Oct 23 '23 14:10 kud

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

0xluc avatar Oct 24 '23 00:10 0xluc

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

ZA0068 avatar Oct 28 '23 14:10 ZA0068

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

ZA0068 avatar Oct 28 '23 14:10 ZA0068

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!

CarolineMorton avatar Nov 02 '23 12:11 CarolineMorton

This is pretty annoying :(

julien-blanchon avatar Nov 04 '23 13:11 julien-blanchon

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

Luk9091 avatar Nov 08 '23 00:11 Luk9091

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

julien-blanchon avatar Nov 08 '23 13:11 julien-blanchon

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

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

joo920131 avatar Nov 09 '23 01:11 joo920131

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

ingorichter avatar Nov 13 '23 16:11 ingorichter

anyone know if rolling back to an older version works?

lockieluke avatar Nov 19 '23 19:11 lockieluke

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.

AustinColby avatar Nov 19 '23 19:11 AustinColby

This is annoying. It also happens to Fedora 39.

tsumarios avatar Dec 11 '23 13:12 tsumarios

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

imreallyliam avatar Dec 22 '23 04:12 imreallyliam

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

0xl30 avatar Jan 08 '24 04:01 0xl30

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

ChloeColman avatar Jan 15 '24 18:01 ChloeColman

same question

edte avatar Feb 21 '24 03:02 edte

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

weberam2 avatar Feb 22 '24 21:02 weberam2

Hopefully, i will give it a try.

t40mas avatar Feb 22 '24 21:02 t40mas

Hopefully, i will give it a try.

Nope, unfortunately it's not working for me.

t40mas avatar Feb 22 '24 21:02 t40mas

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 avatar Feb 27 '24 23:02 lukaskretzschmer

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.

lukaskretzschmer avatar Feb 27 '24 23:02 lukaskretzschmer

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.

samscientist avatar May 25 '24 14:05 samscientist

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

marlonrichert avatar Jun 05 '24 10:06 marlonrichert