Skip to content
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

First require locks up neovim for ~10 seconds #82

Closed
devth opened this issue Jan 8, 2019 · 17 comments
Closed

First require locks up neovim for ~10 seconds #82

devth opened this issue Jan 8, 2019 · 17 comments
Labels
neovim Neovim's behaviors

Comments

@devth
Copy link

devth commented Jan 8, 2019

After :IcedConnect the first :IcedRequire locks up neovim for about 10 seconds. During this time I can't move the cursor or do anything inside neovim. After that subsequent :IcedRequires run nearly instantly.

NVIM v0.3.2-996-g55c518588
Terminal: kitty 0.13.1

Ref #77

@liquidz
Copy link
Owner

liquidz commented Jan 8, 2019

@devth Thank you for the reporting!

Does this problem occur in any project?
Could you provide the steps to reproduce?

@devth
Copy link
Author

devth commented Jan 8, 2019

I tried it in my yetibot project. It seems to repro on any file I try requiring after initial :IcedRequire.

Trying on a fresh project doesn't seem to freeze:

lein new iced-repro
cd iced-repro
iced repl

In neovim:

nvim src/iced_repro/core.clj
:IcedConnect
# nvim freezes for about 1 second 
<Leader>eb
# no freeze

So it doesn't appear to happen on a fresh project. I'll keep playing with it. Maybe has to do with how much source code is in the project?

@devth
Copy link
Author

devth commented Jan 8, 2019

Noticed a large error after connecting and trying to :IcedEval a simple expression:

|| Connected.
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
|| Traceback (most recent call last):
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
||   File "<string>", line 3, in <module>
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
||   File "/Users/thartman/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 287, in command
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
||     return self.request('nvim_command', string, **kwargs)
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
||   File "/Users/thartman/Library/Python/3.7/lib/python/site-packages/pynvim/api/nvim.py", line 182, in request
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
||     res = self._session.request(name, *args, **kwargs)
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
||   File "/Users/thartman/Library/Python/3.7/lib/python/site-packages/pynvim/msgpack_rpc/session.py", line 102, in request
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
||     raise self.error_wrapper(err)
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
|| Error detected while processing function
|| <lambda>7[1]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/nrepl.vim|130| <SNR>197_dispatcher[5]
/Users/thartman/.config/nvim/plugged/vim-iced/autoload/iced/di/bencode/python.vim|13| <SNR>219_decode_via_python[6]
|| provider#python3#Call[18]
|| pynvim.api.nvim.NvimError: b'Keyboard interrupt'

After that when I try to :IcedEval anything it just says Still reading....

@liquidz
Copy link
Owner

liquidz commented Jan 9, 2019

@devth I couldn't reproduce the problem with following steps...

I uses nvim 0.3.2.
https://github.com/neovim/neovim/releases/tag/v0.3.2

$ nvim --version
NVIM v0.3.2
Build type: RelWithDebInfo
LuaJIT 2.0.5
...

It seems to me you use nvim 0.3.2(nightly), so could you update nvim 0.3.2(released) or later and test again?

@devth
Copy link
Author

devth commented Jan 9, 2019

Upgraded to NVIM v0.4.0-1183-g8510d5ff8.
Also upgraded to latest commit on vim-iced dev branch.

  1. Opened new neovim instance
  2. Ran iced repl in a terminal inside vim
  3. Opened slack.clj
  4. :IcedConnect
  5. <Leader>eb - immediately says Required in the statusline but then locks up for 10 seconds

@liquidz
Copy link
Owner

liquidz commented Jan 10, 2019

@devth Thanks!
But I cannot reproduce yet..
I'll keep testing with yetibot.core

@devth
Copy link
Author

devth commented Jan 11, 2019

Strange. I will also keep testing on my side and see if I can narrow down what's going on!

@liquidz
Copy link
Owner

liquidz commented Jan 15, 2019

@devth

  1. eb - immediately says Required in the statusline but then locks up for 10 seconds

The fact that "Required" is output means IcedRequire should have finished.
So something else should be running afterwards. (It may be other configurations or other plugins)

I made a minimal configuration for vim-iced for breaking down this problem.
https://scrapbox.io/vim-iced/Minimal_configuration
Could you launch nvim with this minimal configuration and test again?

@devth
Copy link
Author

devth commented Jan 17, 2019

Sorry for the delay. I was able to repro the same issue in the paired down nvim with minimal config.

@liquidz
Copy link
Owner

liquidz commented Jan 21, 2019

@devth
I can reproduce the problem finally!!
Do you have :plugins [[cider/cider-nrepl "..."]] in your ~/.lein/profiles.clj?

cider-nrepl plugin injects all cider-nrepl middlewares containing track-state.
https://github.com/clojure-emacs/cider-nrepl/blob/v0.20.0/src/cider/nrepl.clj#L511
track-state middleware will send a huge data after requiring namespace, and it take times.

iced command is excluding track-state middleware intentionally.
https://github.com/liquidz/vim-iced/blob/0.9.2/clj/iced_repl.clj#L4-L18
So if you have :plugins [[cider/cider-nrepl "..."]] in your ~/.lein/profiles.clj, please delete it.

@devth
Copy link
Author

devth commented Jan 21, 2019

Amazing! Nice job. I will try this out soon. I always thought cider-nrepl was required.. at least it is for the other vim clojure plugins I've tried: acid.nvim and vim-fireplace. 🤔

@liquidz
Copy link
Owner

liquidz commented Jan 21, 2019

@devth Other plugins may require cider-nrepl while iced command injects dependencies automatically.
https://github.com/liquidz/vim-iced/blob/0.9.2/deps.edn#L5

I'll fix to work with track-state middleware in the future.

@knubie
Copy link
Contributor

knubie commented Mar 19, 2019

I'm having a similar issue with my shadow-cljs project.

It seems that shadow-cljs includes the cider-nrepl plugin (which includes all the middleware) when cider/cider-nrepl is detected in your dependencies.

At the moment there's no way to turn this feature off.

@knubie
Copy link
Contributor

knubie commented Mar 23, 2019

@liquidz After speaking to the maintainer of shadow-cljs on slack, you can now disable the automatic inclusion of cider middleware as of 2.8.20!

I just tried it out and the delay is gone now.

@liquidz
Copy link
Owner

liquidz commented Mar 23, 2019

@knubie Wow! That's awesome!!
Thanks for your reporting!

@liquidz
Copy link
Owner

liquidz commented Dec 30, 2019

Closed by branching to #170
Feel free to reopen this issue 😃

@liquidz liquidz closed this as completed Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
neovim Neovim's behaviors
Projects
None yet
Development

No branches or pull requests

3 participants