reobin / typewritten

A minimal, lightweight, informative zsh prompt theme
https://typewritten.dev
MIT License
908 stars 65 forks source link

Random async error message #50

Closed oniGino closed 4 years ago

oniGino commented 4 years ago

Not sure how to reproduce this it happens randomly it seems

❯                                                                                                                          typewritten
async_worker_eval: no such async worker: _worker
async_job: no such async worker: _worker
async_job: no such async worker: _worker
async_job: no such async worker: _worker
❯                                            

I have to exist and restart the shell to get it to go away, it will print this error after every command

reobin commented 4 years ago

Hi @oniGino !

When you reload zsh, does the error go away?

You mention "random". How often do you open a session and the error is there?

What way did you use to install typewritten?

oniGino commented 4 years ago

Yes reloading a new shell fixes the error, and if i have multiple shells it only effects the one

oniGino commented 4 years ago

I followed the manual install instructions

reobin commented 4 years ago

Interesting 🤔

I'll reinstall it on my side using the manual instruction and see it that pops up.

reobin commented 4 years ago

It seems that the async worker initialized at startup could not do it properly.

Maybe try to install it using npm or another way. I'll try to debug this this week.

Thanks for taking the time to file this bug request!

oniGino commented 4 years ago

OK I think I found out how to trigger this, looks like something when I'm copy and pasting from my clipboard

I'm running sway in wayland and using konsole, however I was able to repeat this inside of visual studio code

oniGino commented 4 years ago

was able to reproduce reliably just by ls on my .config directory This only works in visual studio code shell, but not reproducible in konsole with this method

❯                                                                                                                                                                                        .config
❯ ls                                                                                                                                                                                     .config
 AdBlockadblockrc               discord                       kcmkmailsummaryrc                       kprivacyrc                                plasma-workspace
'Android Open Source Project'   discoverrc                    kcmknotessummaryrc                      krdcrc                                    plasma_calendar_holiday_regions
 Ankama                         dolphinrc                     kcmsambarc                              kritadisplayrc                            plasmanotifyrc
'Ankama Launcher'               drkonqirc                     kcmshell5rc                             kritarc                                   plasmarc
 Audaciousrc                    elisarc                       kconf_updaterc                          krunnerrc                                 plasmashellrc
 Bitcoin                        emaildefaults                 kcookiejarrc                            kscreenlockerrc                           plasmavaultrc
 Bracia                         enchant                       kde.org                                 kservicemenurc                            powerdevil.notifyrc
 Code                           environment.d                 kdebugrc                                ksmserverrc                               powerdevilrc
 GNS3                           eventviewsrc                  kdeconnect                              ksplashrc                                 powermanagementprofilesrc
 GNS3rc                         fbn.cx                        kded5rc                                 ksysguardrc                               print-manager
 ImageMagick                    filelightrc                   kded_device_automounterrc               ksystemlogrc                              pulse
 KDE                            filetypesrc                   kdeglobals                              ktimerrc                                  qt5ct
 Kitware                        flaska.net                    kdenliverc                              ktimezonedrc                              qtchooser
 MusicBrainz                    foldermailarchiverc           kdeveloprc                              ktnefrc                                   ranger
 Musiquerc                      fontconfig                    kdfrc                                   ktorrent_infowidgetrc                     retroarch
 Picardrc                       fontforge                     kdialogrc                               ktorrent_ipfilterrc                       rncbc.org
 QSyncthingTray                 freshwrapper-data             keditbookmarksrc                        ktorrentrc                                sddmthemeinstallerrc
 QtEmu                          ghb                           keditfiletyperc                         ktrashrc                                  session
 QtProject                      glib-2.0                      keepassx                                kuriikwsfilterrc                          showfotorc
 QtProject.conf                 globalnotesettings            kfontinstuirc                           kwalletmanager5rc                         skypeforlinux
 Signal                         google-chrome                 kfontviewrc                             kwalletrc                                 snes9x
 Slack                          gtk-2.0                       kgammarc                                kwin_dialogsrc                            soffice.binrc
 Trolltech.conf                 gtk-3.0                       kglobalshortcutsrc                      kwinrc                                    specialmailcollectionsrc
 VSCodium                       gtkrc                         kglobalshortcutsrc-backu                kwinrulesrc                               spectaclerc
 VanDyke                        gtkrc-2.0                     kglobalshortcutsrc-new                  kwriterc                                  startupconfig
 VirtualBoxrc                   gwenviewrc                    kgpgrc                                  kxkbrc                                    startupconfigfiles
 Webcamoid                      headerthemeeditorrc           khotkeysrc                              libkleopatrarc                            startupconfigkeys
 akregatorrc                    htop                          khtmlrc                                 libreoffice                               storageservicemanagerrc
 amarokrc                       i3blocks                      kimagemapeditorrc                       lo_kde5filepickerrc                       sway
 ankama                         importwizardrc                kinfocenterrc                           lowblog.nl                                swaylock
 arkrc                          incidenceeditorrc             kio_httprc                              mailtransports                            syncthing
 auroraerc                      kaccessrc                     kiorc                                   mailviewerrc                              syncthingtray.ini
 autostart                      kactivitymanagerd-pluginsrc   kioslaverc                              mako                                      systemmonitorrc
 autostart-scripts              kactivitymanagerd-statsrc     kleopatracertificateselectiondialogrc   marblerc                                  systemsettingsrc
 awesome                        kactivitymanagerd-switcher    kleopatrarc                             menus                                     templatesconfigurationrc
 baloofileinformationrc         kactivitymanagerdrc           klipperrc                               mimeapps.list                             thefuck
 baloofilerc                    kaddressbookrc                kmail2rc                                mkchromecast                              touchpadrc
 baloorc                        kalarmrc                      kmailsearchindexingrc                   oktetarc                                  transmission
 blogilorc                      kamerkarc                     kmenueditrc                             okularpartrc                              trashrc
 bluedevilglobalrc              katemetainfos                 kmetainformationrc                      okularrc                                  user-dirs.dirs
 bluedevilreceiverrc            katepartrc                    kmixctrlrc                              org.kde.gwenviewrc                        viewnior
 breezerc                       katerc                        kmixrc                                  oxygenrc                                  vlc
 calligrawordsrc                kateschemarc                  knotesrc                                partitionmanagerrc                        vlcrc
 cef_user_data                  katesyntaxhighlightingrc      knotifyrc                               pavucontrol.ini                           volti
 chromium                       katevirc                      konq_history                            phishingurlrc                             webengineurlinterceptoradblockrc
 cmst                           kbackuprc                     konquerorrc                             pimpluginsrc                              weston.ini
 configstore                    kcalcrc                       konsolerc                               pip                                       xsettingsd
 coonsden                       kcharselectrc                 kontact_summaryrc                       plasma-locale-settings.sh                 zaap
 dconf                          kcmdisplayrc                  kontactrc                               plasma-localerc                           zoomus.conf
 device_automounter_kcmrc       kcmfonts                      korgacrc                                plasma-nm
 digikamrc                      kcminputrc                    korganizerrc                            plasma-org.kde.plasma.desktop-appletsrc
❯                                                                                                                                                                                        .config
❯ ls                                                                                                                                                                                     .config
 AdBlockadblockrc               discord                       kcmkmailsummaryrc                       kprivacyrc                                plasma-workspace
'Android Open Source Project'   discoverrc                    kcmknotessummaryrc                      krdcrc                                    plasma_calendar_holiday_regions
 Ankama                         dolphinrc                     kcmsambarc                              kritadisplayrc                            plasmanotifyrc
'Ankama Launcher'               drkonqirc                     kcmshell5rc                             kritarc                                   plasmarc
 Audaciousrc                    elisarc                       kconf_updaterc                          krunnerrc                                 plasmashellrc
 Bitcoin                        emaildefaults                 kcookiejarrc                            kscreenlockerrc                           plasmavaultrc
 Bracia                         enchant                       kde.org                                 kservicemenurc                            powerdevil.notifyrc
 Code                           environment.d                 kdebugrc                                ksmserverrc                               powerdevilrc
 GNS3                           eventviewsrc                  kdeconnect                              ksplashrc                                 powermanagementprofilesrc
 GNS3rc                         fbn.cx                        kded5rc                                 ksysguardrc                               print-manager
 ImageMagick                    filelightrc                   kded_device_automounterrc               ksystemlogrc                              pulse
 KDE                            filetypesrc                   kdeglobals                              ktimerrc                                  qt5ct
 Kitware                        flaska.net                    kdenliverc                              ktimezonedrc                              qtchooser
 MusicBrainz                    foldermailarchiverc           kdeveloprc                              ktnefrc                                   ranger
 Musiquerc                      fontconfig                    kdfrc                                   ktorrent_infowidgetrc                     retroarch
 Picardrc                       fontforge                     kdialogrc                               ktorrent_ipfilterrc                       rncbc.org
 QSyncthingTray                 freshwrapper-data             keditbookmarksrc                        ktorrentrc                                sddmthemeinstallerrc
 QtEmu                          ghb                           keditfiletyperc                         ktrashrc                                  session
 QtProject                      glib-2.0                      keepassx                                kuriikwsfilterrc                          showfotorc
 QtProject.conf                 globalnotesettings            kfontinstuirc                           kwalletmanager5rc                         skypeforlinux
 Signal                         google-chrome                 kfontviewrc                             kwalletrc                                 snes9x
 Slack                          gtk-2.0                       kgammarc                                kwin_dialogsrc                            soffice.binrc
 Trolltech.conf                 gtk-3.0                       kglobalshortcutsrc                      kwinrc                                    specialmailcollectionsrc
 VSCodium                       gtkrc                         kglobalshortcutsrc-backu                kwinrulesrc                               spectaclerc
 VanDyke                        gtkrc-2.0                     kglobalshortcutsrc-new                  kwriterc                                  startupconfig
 VirtualBoxrc                   gwenviewrc                    kgpgrc                                  kxkbrc                                    startupconfigfiles
 Webcamoid                      headerthemeeditorrc           khotkeysrc                              libkleopatrarc                            startupconfigkeys
 akregatorrc                    htop                          khtmlrc                                 libreoffice                               storageservicemanagerrc
 amarokrc                       i3blocks                      kimagemapeditorrc                       lo_kde5filepickerrc                       sway
 ankama                         importwizardrc                kinfocenterrc                           lowblog.nl                                swaylock
 arkrc                          incidenceeditorrc             kio_httprc                              mailtransports                            syncthing
 auroraerc                      kaccessrc                     kiorc                                   mailviewerrc                              syncthingtray.ini
 autostart                      kactivitymanagerd-pluginsrc   kioslaverc                              mako                                      systemmonitorrc
 autostart-scripts              kactivitymanagerd-statsrc     kleopatracertificateselectiondialogrc   marblerc                                  systemsettingsrc
 awesome                        kactivitymanagerd-switcher    kleopatrarc                             menus                                     templatesconfigurationrc
 baloofileinformationrc         kactivitymanagerdrc           klipperrc                               mimeapps.list                             thefuck
 baloofilerc                    kaddressbookrc                kmail2rc                                mkchromecast                              touchpadrc
 baloorc                        kalarmrc                      kmailsearchindexingrc                   oktetarc                                  transmission
 blogilorc                      kamerkarc                     kmenueditrc                             okularpartrc                              trashrc
 bluedevilglobalrc              katemetainfos                 kmetainformationrc                      okularrc                                  user-dirs.dirs
 bluedevilreceiverrc            katepartrc                    kmixctrlrc                              org.kde.gwenviewrc                        viewnior
 breezerc                       katerc                        kmixrc                                  oxygenrc                                  vlc
 calligrawordsrc                kateschemarc                  knotesrc                                partitionmanagerrc                        vlcrc
 cef_user_data                  katesyntaxhighlightingrc      knotifyrc                               pavucontrol.ini                           volti
 chromium                       katevirc                      konq_history                            phishingurlrc                             webengineurlinterceptoradblockrc
 cmst                           kbackuprc                     konquerorrc                             pimpluginsrc                              weston.ini
 configstore                    kcalcrc                       konsolerc                               pip                                       xsettingsd
 coonsden                       kcharselectrc                 kontact_summaryrc                       plasma-locale-settings.sh                 zaap
 dconf                          kcmdisplayrc                  kontactrc                               plasma-localerc                           zoomus.conf
 device_automounter_kcmrc       kcmfonts                      korgacrc                                plasma-nm
 digikamrc                      kcminputrc                    korganizerrc                            plasma-org.kde.plasma.desktop-appletsrc
❯ cd ..                                                                                                                                                                                  .config
async_worker_eval: no such async worker: _worker                                                                                                                                                 
async_job: no such async worker: _worker
async_job: no such async worker: _worker
async_job: no such async worker: _worker
❯        
oniGino commented 4 years ago

here is my zshrc btw

#AutoComplete
zstyle ':completion:*' completer _complete _ignored
zstyle :compinstall filename '/home/grey/.zshrc'
autoload -Uz compinit
compinit
#Typewritten Theme
fpath+=$HOME/.zsh/typewritten
autoload -U promptinit; promptinit
prompt typewritten
#KeyBindings
bindkey "^A" vi-beginning-of-line
bindkey "^E" vi-end-of-line
bindkey -e
bindkey "^[[3~" delete-char

HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
#Opts
setopt autocd
setopt nullglob
#Plugins
source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
source /home/grey/.zsh/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh

#Other
alias grep='grep --colour=always'
alias ls='ls --color=auto'

eval $(keychain --eval --agents ssh,gpg -q)
#export PATH=/home/grey/.cargo/bin:/home/grey/.local/bin:/home/grey/workspace/go/bin:/home/grey/workspace/Android/SDK/platform-tools:$PATH
export $(/usr/lib/systemd/user-environment-generators/30-systemd-environment-d-generator)
export GOPATH=/home/grey/workspace/go
export BROWSER=/usr/bin/firefox
reobin commented 4 years ago

@oniGino Thanks for all the info! Will have a look tomorrow using your setup

frdrk commented 4 years ago

Just letting you know that I'm getting this same error too. Clean install from a few days ago with oh-my-zsh. Happens consistently after a few minutes of normal terminal use.

reobin commented 4 years ago

Thanks for letting me know @frdrk !

I have a fix in mind right now. I'm pretty sure it's related to https://github.com/mafredri/zsh-async/issues/42.

I'm not able to reproduce the error, though. So it's pretty hard for me to debug.

If you would like to help, there is one comment that mentions that a temporary workaround would be to initialize the worker on the precmd hook.

Could you add these lines just after _prompt_precmd() { on line 94? :

async_start_worker _worker -n
async_register_callback _worker _prompt_callback

The file is at ~/.zsh/typewritten/typewritten.zsh

Then reload zsh and see if the error still happens. Thanks!

frdrk commented 4 years ago

Thanks @reobin ! Been running for a few hours now with no issues. It seem to have done the trick.

reobin commented 4 years ago

@frdrk cool!

It's definitely not a viable fix to package in the theme, but I'm glad it worked for now.

What I'll end up doing is check for errors on the async callback function, and if there are any, reinitialize the worker.

I'll keep this open and work on it soon. I'll probably need some quick testing if you're up for it! I'll keep this issue up to date.

frdrk commented 4 years ago

No worries. I'm no power user but I'll help out any way I can.

reobin commented 4 years ago

@frdrk I pushed to a branch called fix/workers.

If you could pull it and use it for a while, it would be greatly appreciated.

What's new is a check for return code in the callback function. When the return code is equal to some values, the workers are reinitialized and the async functions called again.

For now, when the workers die, a message about it is displayed, and they get reinitialize. I'll leave the messages to help you identify when it happens, and if it gets reinitialized correctly. Then, before pushing to master, we'll remove them.

Cheers!

reobin commented 4 years ago

@all-contributors please add @oniGino for bug

allcontributors[bot] commented 4 years ago

@reobin

I've put up a pull request to add @oniGino! :tada:

reobin commented 4 years ago

@all-contributors please add @frdrk for bug, and userTesting

allcontributors[bot] commented 4 years ago

@reobin

I've put up a pull request to add @frdrk! :tada: