R-nvim / R.nvim

Neovim plugin to edit R files
GNU General Public License v3.0
155 stars 16 forks source link

connection with R.nvim was lost #109

Closed samtrek closed 5 months ago

samtrek commented 6 months ago

completion failure after attempting to complete the arguments of functions/methods mostly after 2-3 methods and functions Latest R.nvim cb65c3b gives the error Connection with R.nvim was lost

jalvesaq commented 6 months ago

I can't replicate the issue. Do you have any hook function set? This is what changed in the commit that you mentioned.

jalvesaq commented 6 months ago

See also: https://github.com/R-nvim/R.nvim/wiki/Debugging-C-code-with-Valgrind

samtrek commented 5 months ago

Yes I have a hook function in my config, from the suggested config, in addition to this I have this vim.api.nvim_buf_set_keymap(0, "i", "", " |>", {}), I will check out how to use valgrind in order to be able to give a more detailed error.

samtrek commented 5 months ago

I have tested R with valingrad, the main culprit is the for() method, the magritrr from tidyverse package is also stopping completion if called with library(), the valgrind error output is below ==283561== Invalid read of size 1 ==283561== at 0x110732: str_here (common.c:16) ==283561== by 0x10AD16: resolve_arg_item (complete.c:207) ==283561== by 0x10F7A8: stdin_loop (rnvimserver.c:240) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== Address 0x4c3d393 is 0 bytes after a block of size 201,587 alloc'd ==283561== at 0x484A993: calloc (vg_replace_malloc.c:1595) ==283561== by 0x11060E: read_file (utilities.c:115) ==283561== by 0x10D420: read_args_file (data_structures.c:626) ==283561== by 0x10D4F8: load_pkg_data (data_structures.c:643) ==283561== by 0x10D7D9: finish_bol (data_structures.c:710) ==283561== by 0x10D93B: finished_building_objls (data_structures.c:736) ==283561== by 0x10F4CC: stdin_loop (rnvimserver.c:176) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== ==283561== Invalid read of size 1 ==283561== at 0x10ADF4: resolve_arg_item (complete.c:202) ==283561== by 0x10F7A8: stdin_loop (rnvimserver.c:240) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== Address 0x4c3d394 is 1 bytes after a block of size 201,587 alloc'd ==283561== at 0x484A993: calloc (vg_replace_malloc.c:1595) ==283561== by 0x11060E: read_file (utilities.c:115) ==283561== by 0x10D420: read_args_file (data_structures.c:626) ==283561== by 0x10D4F8: load_pkg_data (data_structures.c:643) ==283561== by 0x10D7D9: finish_bol (data_structures.c:710) ==283561== by 0x10D93B: finished_building_objls (data_structures.c:736) ==283561== by 0x10F4CC: stdin_loop (rnvimserver.c:176) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== ==283561== Invalid read of size 1 ==283561== at 0x10ACE9: resolve_arg_item (complete.c:205) ==283561== by 0x10F7A8: stdin_loop (rnvimserver.c:240) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== Address 0x4c3d394 is 1 bytes after a block of size 201,587 alloc'd ==283561== at 0x484A993: calloc (vg_replace_malloc.c:1595) ==283561== by 0x11060E: read_file (utilities.c:115) ==283561== by 0x10D420: read_args_file (data_structures.c:626) ==283561== by 0x10D4F8: load_pkg_data (data_structures.c:643) ==283561== by 0x10D7D9: finish_bol (data_structures.c:710) ==283561== by 0x10D93B: finished_building_objls (data_structures.c:736) ==283561== by 0x10F4CC: stdin_loop (rnvimserver.c:176) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== ==283561== Invalid read of size 1 ==283561== at 0x10ACF4: resolve_arg_item (complete.c:205) ==283561== by 0x10F7A8: stdin_loop (rnvimserver.c:240) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== Address 0x4c3d3b8 is 24 bytes after a block of size 201,600 in arena "client" ==283561== ==283561== Invalid read of size 1 ==283561== at 0x110704: str_here (common.c:17) ==283561== by 0x10AD16: resolve_arg_item (complete.c:207) ==283561== by 0x10F7A8: stdin_loop (rnvimserver.c:240) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== Address 0x4c3d3c0 is 32 bytes before a block of size 480 in arena "client" ==283561== ==283561== ==283561== HEAP SUMMARY: ==283561== in use at exit: 2,438,615 bytes in 1,422 blocks ==283561== total heap usage: 1,586 allocs, 164 frees, 2,841,544 bytes allocated ==283561== ==283561== 272 bytes in 1 blocks are possibly lost in loss record 16 of 28 ==283561== at 0x484A993: calloc (vg_replace_malloc.c:1595) ==283561== by 0x40116B2: calloc (rtld-malloc.h:44) ==283561== by 0x40116B2: allocate_dtv (dl-tls.c:370) ==283561== by 0x4012111: _dl_allocate_tls (dl-tls.c:629) ==283561== by 0x4923028: allocate_stack (allocatestack.c:429) ==283561== by 0x4923028: pthread_create@@GLIBC_2.34 (pthread_create.c:655) ==283561== by 0x110367: start_server (tcp.c:400) ==283561== by 0x10F33B: stdin_loop (rnvimserver.c:128) ==283561== by 0x10F86E: main (rnvimserver.c:268) ==283561== ==283561== LEAK SUMMARY: ==283561== definitely lost: 0 bytes in 0 blocks ==283561== indirectly lost: 0 bytes in 0 blocks ==283561== possibly lost: 272 bytes in 1 blocks ==283561== still reachable: 2,438,343 bytes in 1,421 blocks ==283561== suppressed: 0 bytes in 0 blocks ==283561== Reachable blocks (those to which a pointer was found) are not shown. ==283561== To see them, rerun with: --leak-check=full --show-leak-kinds=all ==283561== ==283561== For lists of detected and suppressed errors, rerun with: -s ==283561== ERROR SUMMARY: 5830 errors from 6 contexts (suppressed: 0 from 0)

jalvesaq commented 5 months ago

Thank you for hunting the bugs and finding them (magrttir and for)! Could you try the branch fix_compl_bugs, please?

samtrek commented 5 months ago

I think, it can be merged with the main, I have tried to run the same scenario that led to the bug and, it has not thrown any error for both for() and magrittr package. Thank you for your efforts really appreciate it.

jalvesaq commented 5 months ago

Thank you for trying it!