neoclide/coc-r-lsp

Cannot call write after stream was destroyed

rodrigo-pino opened this issue · 2 comments

Hi, I'm getting the previous mentioned error every time I open an R file. I don't know if it could be caused due to recently updating R to 4.1.2, or if I messed up smth that broke TCP connection perhaps.

It is not a coc-nvim issue since this only hapens with this extension. The R languageserver is installed and updated.

This is what CocInfo shows:

## versions

vim version: NVIM v0.6.0-dev+631-g72d62aa6a
node version: v17.1.0
coc.nvim version: 0.0.80-0480cbd997
coc.nvim directory: /home/rodro/.local/share/nvim/plugged/coc.nvim
term: xterm-kitty
platform: linux

## Log of coc.nvim

2021-11-27T11:19:00.667 INFO (pid:33518) [services] - registered service "languageserver.prolog-lsp"
2021-11-27T11:19:00.670 INFO (pid:33518) [services] - registered service "languageserver.solidity"
2021-11-27T11:19:00.941 INFO (pid:33518) [coc-git] - Looking for git in: git
2021-11-27T11:19:01.197 INFO (pid:33518) [extension:coc-r-lsp] - Start language server for file:///home/rodro/Aarka/Skull/2do_Semestre_4to/Estadistica/Secciones/Seccion%208/answers/ex2.R
2021-11-27T11:19:01.226 INFO (pid:33518) [extension:coc-r-lsp] - R binary: /usr/bin/R
2021-11-27T11:19:01.227 INFO (pid:33518) [extension:coc-r-lsp] - LANG: en_US.UTF-8
2021-11-27T11:19:01.233 INFO (pid:33518) [plugin] - coc.nvim 0.0.80-0480cbd997 initialized with node: v17.1.0 after 746ms
2021-11-27T11:19:01.524 INFO (pid:33518) [attach] - Request action: diagnosticList []
2021-11-27T11:19:01.616 INFO (pid:33518) [extension:coc-r-lsp] - R process connected
2021-11-27T11:19:01.794 INFO (pid:33518) [attach] - Request action: diagnosticList []
2021-11-27T11:19:01.795 INFO (pid:33518) [attach] - Request action: diagnosticList []
2021-11-27T11:19:01.801 INFO (pid:33518) [attach] - Request action: diagnosticList []
2021-11-27T11:19:01.810 INFO (pid:33518) [attach] - Request action: diagnosticList []
2021-11-27T11:19:01.814 INFO (pid:33518) [attach] - Request action: diagnosticList []
2021-11-27T11:19:01.874 INFO (pid:33518) [attach] - receive notification: runCommand [
  'coc-helper.internal.didVimEvent_m2_v0_11_1_Floatinput_4',
  'CocStatusChange'
]
2021-11-27T11:19:01.939 ERROR (pid:33518) [language-client-client] - connection error: Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:220:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
} undefined
2021-11-27T11:19:01.945 ERROR (pid:33518) [language-client-client] - connection error: Error: read ECONNRESET
    at TCP.onStreamRead (node:internal/stream_base_commons:220:20) {
  errno: -104,
  code: 'ECONNRESET',
  syscall: 'read'
} undefined
2021-11-27T11:19:01.950 ERROR (pid:33518) [language-client-client] - connection error: Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at new NodeError (node:internal/errors:371:5)
    at _write (node:internal/streams/writable:322:11)
    at Socket.Writable.write (node:internal/streams/writable:335:10)
    at /home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:12134:25
    at new Promise (<anonymous>)
    at WritableStreamWrapper.write (/home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:12125:16)
    at StreamMessageWriter2.doWrite (/home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:13035:31)
    at /home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:13026:25 {
  code: 'ERR_STREAM_DESTROYED'
} { jsonrpc: '2.0', id: 1, method: 'shutdown', params: undefined }
2021-11-27T11:19:01.954 ERROR (pid:33518) [server] - unhandledRejection  Promise {
  <rejected> Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
      at new NodeError (node:internal/errors:371:5)
      at _write (node:internal/streams/writable:322:11)
      at Socket.Writable.write (node:internal/streams/writable:335:10)
      at /home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:12134:25
      at new Promise (<anonymous>)
      at WritableStreamWrapper.write (/home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:12125:16)
      at StreamMessageWriter2.doWrite (/home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:13035:31)
      at /home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:13026:25 {
    code: 'ERR_STREAM_DESTROYED'
  }
} Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at new NodeError (node:internal/errors:371:5)
    at _write (node:internal/streams/writable:322:11)
    at Socket.Writable.write (node:internal/streams/writable:335:10)
    at /home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:12134:25
    at new Promise (<anonymous>)
    at WritableStreamWrapper.write (/home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:12125:16)
    at StreamMessageWriter2.doWrite (/home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:13035:31)
    at /home/rodro/.local/share/nvim/plugged/coc.nvim/build/index.js:13026:25 {
  code: 'ERR_STREAM_DESTROYED'
}
2021-11-27T11:19:05.797 INFO (pid:33518) [attach] - receive notification: showInfo []

Try use node 16 might helps.

Same issue here, regardless of node version (getting this with both 16 and 17).

Edit: Strangely, I was able to solve this via install.packages("stringi"), which seemed to have been missing before ("strange" because this package should've been installed automatically alongside the languageserver package).