wbthomason / packer.nvim

A use-package inspired plugin manager for Neovim. Uses native packages, supports Luarocks dependencies, written in Lua, allows for expressive config
MIT License
7.89k stars 264 forks source link

"Error executing luv callback:", bad argument #1 #120

Open garymh opened 3 years ago

garymh commented 3 years ago

Hi! I'm getting the following error message using packer with nightly neovim:

Error executing luv callback: ...vim/site/pack/packer/opt/packer.nvim/lua/packer/jobs.lua:76: bad argument #1 to 'is_active' (Expected uv_handle userdata)

This happens when trying to use PackerInstall or PackerSync- a large majority of the packages will update fine, but 7 or 8 seem to freeze on the "Cloning..." part of the update. After a minute or two, the above error message shows up.

Here is my plugins.lua:

vim.cmd [[packadd packer.nvim]]

function has_tmux()
  return os.getenv('TMUX') == true
end

return require('packer').startup(function()
  -- Packer can manage itself as an optional plugin
  use {'wbthomason/packer.nvim', opt = true}
  use {'norcalli/nvim_utils'}

  ruby_filetypes = {'ruby', 'eruby', 'slim', 'haml', 'rspec'}
  use {'ngmy/vim-rubocop',  ft = ruby_filetypes}
  use {'tpope/vim-endwise', ft = ruby_filetypes}

  use {'christoomey/vim-tmux-navigator',     cond = has_tmux()}
  use {'benmills/vimux',                     cond = has_tmux()}
  use {'tmux-plugins/vim-tmux-focus-events', cond = has_tmux()}

  use {'AndrewRadev/undoquit.vim',    opt = true, cmd = {'Undoquit'}}
  use {'mhinz/vim-sayonara',          opt = true, cmd = {'Sayonara'}}
  use {'AndrewRadev/splitjoin.vim',   opt = true, cmd = {'SplitjoinSplit', 'SplitjoinJoin'}}
  use {'AndrewRadev/multichange.vim', opt = true, cmd = {'Multichange'}}
  use {'foosoft/vim-argwrap',         opt = true, cmd = {'ArgWrap'}}
  use {'AndrewRadev/deleft.vim',      opt = true, cmd = {'Deleft'}}
  use {'liuchengxu/vista.vim',        opt = true, cmd = {'Vista'}}
  use {'eugen0329/vim-esearch',       opt = true, key = {'n', '<Plug>(esearch)'}}
  use {'junegunn/vim-easy-align'}
  use {'AndrewRadev/sideways.vim'}
  use {'AndrewRadev/switch.vim'}
  use {'rhysd/git-messenger.vim'}
  use {
    'nvim-telescope/telescope.nvim',
    requires = {{'nvim-lua/popup.nvim'}, {'nvim-lua/plenary.nvim'}}
  }
  use {'https://gitlab.com/alexkalderimis/deoplete-gitlab', run = './bin/install.sh' }
  use {'ripxorip/aerojump.nvim', run = ':UpdateRemotePlugins' }
  use {'AndrewRadev/dsf.vim'}
  use {'AndrewRadev/rails_extra.vim'}
  use {'Shougo/echodoc.vim'}
  use {'airblade/vim-gitgutter'}
  use {'airblade/vim-rooter'}
  use {'christoomey/vim-sort-motion'}
  use {'dkarter/bullets.vim'}
  use {'dstein64/vim-startuptime'}
  use {'duggiefresh/vim-easydir'}
  use {'editorconfig/editorconfig-vim'}
  use {'farmergreg/vim-lastplace'}
  use {'google/vim-searchindex'}
  use {'honza/vim-snippets'}
  use {'janko-m/vim-test'}
  use {'jkramer/vim-checkbox'}
  use {'justinmk/vim-gtfo'}
  use {'kana/vim-niceblock'}
  use {'kristijanhusak/vim-dadbod-completion'}
  use {'kshenoy/vim-signature'}
  use {'liuchengxu/vim-which-key'}
  use {'machakann/vim-sandwich'}
  use {'pechorin/any-jump.vim'}
  use {'pgdouyon/vim-evanesco'}
  use {'sheerun/vim-polyglot'}
  use {'shumphrey/fugitive-gitlab.vim'}
  use {'sickill/vim-pasta'}
  use {'takac/vim-commandcaps'}
  use {'tpope/vim-abolish'}
  use {'tpope/vim-apathy'}
  use {'tpope/vim-commentary'}
  use {'tpope/vim-dadbod'}
  use {'tpope/vim-eunuch'}
  use {'tpope/vim-fugitive'}
  use {'tpope/vim-projectionist'}
  use {'tpope/vim-repeat'}
  use {'tpope/vim-rsi'}
  use {'tpope/vim-unimpaired'}
  use {'wellle/targets.vim'}
  use {'wincent/terminus'}
  use {'wsdjeg/vim-fetch'}
  use {'ntpeters/vim-better-whitespace'}
  use {'kyazdani42/blue-moon'}
  use {'kyazdani42/nvim-web-devicons'}
  use {'luochen1990/rainbow'}
  use {'nanotech/jellybeans.vim'}
  use {'eemed/sitruuna.vim'}
  use {'voldikss/vim-floaterm'}
  use {'pgavlin/pulumi.vim'}
  use {'romgrk/barbar.nvim'}
  use {'yuntan/neovim-indent-guides'}
  use {'wadackel/vim-dogrun'}
  use {'tjdevries/colorbuddy.nvim'}
  use {'ryanoasis/vim-devicons'}
  use {'romgrk/doom-one.vim'}
  use {'camspiers/animate.vim'}
  use {'camspiers/lens.vim'}
  use {'norcalli/nvim-colorizer.lua'}
  use {'ojroques/vim-scrollstatus'}
end)

Misc info: NVIM v0.5.0-dev+941-g9c56d8e5f Build type: Release LuaJIT 2.1.0-beta3 macOS 11.0.1

wbthomason commented 3 years ago

Hmm, interesting. Could you please post your git version as well?

Is it always the same few plugins that fail? If so, which?

Your config looks fine, so I'm suspecting either a weird git issue or a slow network is exposing an issue in the jobs module. Specifically, it looks like the timeout condition is being triggered, but after the job handle is no longer valid?

Also, irrelevant to the problem here: you don't need to manually specify opt for the plugins you lazy-load with cmd or keys; it's implied. You also don't need to use curly braces for the calls with only a single plugin (which imho makes things look nicer, but is a purely aesthetic difference).

garymh commented 3 years ago

Sure: git version 2.29.2

Interestingly it does seem to be some of the same plugins every time!

⟳ AndrewRadev/deleft.vim: cloning...
⟳ AndrewRadev/rails_extra.vim: cloning...
⟳ adriaanzon/vim-textobj-matchit: cloning...
⟳ airblade/vim-gitgutter: cloning...
⟳ benmills/vimux: cloning...
⟳ christoomey/vim-sort-motion: cloning...
⟳ dstein64/vim-startuptime: cloning...
⟳ eugen0329/vim-esearch: cloning...
⟳ honza/vim-snippets: cloning...
⟳ janko-m/vim-test: cloning...
⟳ junegunn/vim-easy-align: cloning...
⟳ justinmk/vim-gtfo: cloning...
⟳ kana/vim-textobj-line: cloning...
⟳ ngmy/vim-rubocop: cloning...
⟳ nvim-lua/completion-nvim: cloning...
⟳ nvim-lua/plenary.nvim: cloning...
⟳ nvim-telescope/telescope-fzy-native.nvim: cloning...
⟳ nvim-telescope/telescope-packer.nvim: cloning...
⟳ nvim-telescope/telescope.nvim: cloning...
⟳ nvim-treesitter/nvim-treesitter-textobjects: cloning...
⟳ nvim-treesitter/nvim-treesitter: cloning...
⟳ ojroques/vim-scrollstatus: cloning...
⟳ rhysd/git-messenger.vim: cloning...
⟳ ripxorip/aerojump.nvim: cloning...
⟳ sheerun/vim-polyglot: cloning...
⟳ takac/vim-commandcaps: cloning...
⟳ tpope/vim-commentary: cloning...
⟳ wadackel/vim-dogrun: cloning...
⟳ yuntan/neovim-indent-guides: cloning...

Although I'm not sure if its something specific to those repos. Just running PackerInstall will install them.

🤔 It does seem like git is getting overloaded somehow.

Ah! Thanks for the Lua tip 😄

wbthomason commented 3 years ago

Fascinating. I have the same git version and cannot reproduce the issue, so I think that theory may be (mostly) dead.

What I did notice when trying to PackerInstall with your config was the following:

  1. Just cloning all of the plugins takes a long time. If you have a poor internet connection, you could easily be running into a timeout issue. packer should still be handling this more gracefully than it is, so there's still a bug, but your problem can maybe be resolved by tweaking the value of git.clone_timeout in the config.
  2. Installing the deoplete-gitlab plugin caused an unexpected password prompt, which could maybe be hanging and blocking progress?
garymh commented 3 years ago

(sorry about the late reply!) My internet connection is pretty good and just removing the deoplete-gitlab plugin didn't seem to help. I also adjusted the git.clone_timeout which didn't seem to do the trick, but changing max_jobs to an actual number (using 10 here) actually seems to work! ¯_(ツ)_/¯ Hopefully if anyone else has this odd problem they can just see this thread 😄

wbthomason commented 3 years ago

Hmm. That's actually concerning, since it points to an error in the async/jobs code.

If anyone else has this problem and finds this issue, please comment or re-open. Since I haven't been able to reproduce this bug yet, I'd be very interested to hear about any new reports of the behavior.

ranebrown commented 3 years ago

I started seeing a similar issue recently. When doing PackerSync 4 plugins would just hang with a "checking current commit" message. I deleted site/pack/packer to see if it was an issue with one of the installed plugins and on reinstall got the same bad argument #1 to 'is_active' (Expected uv_handle userdata) message which led me here. Setting a max_jobs value does seem to fix the issue. Edit: a smallish value, 50 works but 100 causes the same hang.

wbthomason commented 3 years ago

Hmm. I'm going to reopen this, since it seems like there's something wrong (though I'm not sure if it's in Neovim, Luv, or packer).

jaydorsey commented 3 years ago

I've seen similar behavior. Haven't narrowed down the exact root cause yet but a few observations below. My dotfiles are online here but I barely know what I'm doing with the configs since I just switched over most of it to lua.

I think it could be a bad clone/git pull causing the hang, but it's also possible that my config is just bad because I'm seeing some other behavior I don't expect (like RRethy/nvim-treesitter-textsubjects isn't installed alongside the other packs even thought it's specified in my plugins file.

git version 2.33.1
NVIM v0.6.0-dev+533-g653d96329
macOS 11.4 (m1 chip)

Happy to help spend some time pairing/debugging on my machine if this sounds like the same issue, since I can recreate this just be adding coc.nvim (usually) and sometimes impatient as well.

fersdeveloper commented 2 years ago

Fascinating. I have the same git version and cannot reproduce the issue, so I think that theory may be (mostly) dead.

What I did notice when trying to PackerInstall with your config was the following:

1. Just cloning all of the plugins takes a long time. If you have a poor internet connection, you could easily be running into a timeout issue. `packer` should still be handling this more gracefully than it is, so there's still a bug, but your problem can maybe be resolved by tweaking the value of `git.clone_timeout` in the config.

2. Installing the `deoplete-gitlab` plugin caused an unexpected password prompt, which could maybe be hanging and blocking progress?

I have similar problem, how can I change git.clone_timeout?

ilaipi commented 2 years ago

still have this issue, can't resolve it. tried set max_jobs to 50 / 20 / 10, set git.clone_timeout to 600, all not work

winkee01 commented 2 years ago

same here

xosxos commented 2 years ago

I cannot install any packages and get the same error on a new install of Fedora 36.

Git version 2.37.2. 

NVIM v0.7.2
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Cannot get VimPlug to work in vimscript in the init.lua either, so I am stuck without plugins for the moment :(

wbthomason commented 2 years ago

@xosxos: Have you tried setting max_jobs or clone_timeout?

xosxos commented 2 years ago

@xosxos: Have you tried setting max_jobs or clone_timeout?

I just started working on it and this resolved itself on its own just by copy pasting the default settings to my config. Thus I am left quite puzzled. Maybe it was a networking error after all..? Although I was browsing Github at the same time this issue popped up and cloning the Packer repo was also successful from the command line...