tpope / vim-fireplace

fireplace.vim: Clojure REPL support
https://www.vim.org/scripts/script.php?script_id=4978
1.75k stars 139 forks source link

Fireplace transport init sometimes hangs #379

Closed jhoke307 closed 4 years ago

jhoke307 commented 4 years ago

When I first use a command like cpp after starting Vim, it sometimes works almost immediately and sometimes just hangs until I press Ctrl-C, after which no Fireplace commands seem to work (I get different errors about 'E716: Key not present in Dictionary: _path' then). This is with the latest commit 237c122f34132714a55709b4af13b94a10043136. I suspect a race condition handling the startup describe command but my nrepl and Vimscript knowledge is next-to-nonexistent.

I'm attaching a Vim log of it not working. Please let me know if there's any other information which would be helpful. vimtrace.txt.gz

This is on:

VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Jun 21 2019 04:10:35)
Included patches: 1-197, 322, 377-378, 550, 649, 651, 703, 706-707
Extra patches: 8.1.1401, 8.1.1382, 8.1.1368, 8.1.1367, 8.1.1366, 8.1.1365, 8.1.1046, 8.1.0613, 8.1.0547, 8.1.0546, 8.1.0544, 8.1.0540, 8.1.0539, 8.1.0538, 8.1.0506, 8.1.0208, 8.1.0206, 8.1.0205, 8.1.0189, 8.1.0177, 8.1.0067, 8.1.0066
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by pkg-vim-maintainers@lists.alioth.debian.org
jhoke307 commented 4 years ago

Went searching for more information and learned how to turn on Vim's channel log, so here it is. channel.log

jhoke307 commented 4 years ago

I believe this was caused by the bug fixed by Vim patch 8.0.0312:

commit 88989cc381c764978f7d7c8e387f3efc21333b4b
Author: Bram Moolenaar <Bram@vim.org>
Date:   Mon Feb 6 21:56:09 2017 +0100

    patch 8.0.0312: failure when a channel receives a split json message

    Problem:    When a json message arrives in pieces, the start is dropped and
                the decoding fails.
    Solution:   Do not drop the start when it is still needed. (Kay Zheng)  Add a
                test.  Reset the timeout when something is received.

I rebuilt Vim with this patch applied and haven't seen the hang since.