question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error "connection got disposed off" (but not on save as in #247 and #142 but on start/load)

See original GitHub issue

I am having the same (or very similar errors) as mentioned in #142 and #247, but not just on save but when I load an OCaml file. That is for me the VSCode plugin doesn’t work at all. Some notes on my environment:

  • I am on Windows 10 and using a MinGW cross opam running on cygwin from https://fdopen.github.io/opam-repository-mingw/installation/
  • I did opam install merlin and opam install ocp-indent
  • I did not install any OCaml language server (i.e. I did not do npm install -g ocaml-language-server nor do I have nodejs installed) since I didn’t find anything in the installation instructions which recommends this (I just found the reference in some comments on #247 and #142).
  • I call VSCode (code.cmd) from within cygwin from the root folder of a simple OCaml project and with ocamlmerlin in the path. The project I used for testing is yojson-master.
  • VSCode seems to start ocamlmerlin, but then I get the below errors
  • If I call VScode without having ocamlmerlin in the path, I get an error that it can’t find ocamlmerlin instead
  • I am doing OCaml development, not Reason

The error message I get (within 1s after loading any OCaml file):

events.js:167
      throw er; // Unhandled 'error' event
      ^

Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:406:19)
    at writeOrBuffer (_stream_writable.js:394:5)
    at Socket.Writable.write (_stream_writable.js:294:11)
    at Interface._writeToOutput (readline.js:300:17)
    at Interface.prompt (readline.js:264:10)
    at Interface.question (readline.js:277:12)
    at worker (c:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\ocaml-language-server\bin\server\processes\merlin.js:52:31)
    at c:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\async\dist\async.js:4082:9
    at process (c:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\async\dist\async.js:2330:17)
    at Immediate.<anonymous> (c:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\async\dist\async.js:119:16)
Emitted 'error' event at:
    at onwriteError (_stream_writable.js:425:12)
    at onwrite (_stream_writable.js:456:5)
    at doWrite (_stream_writable.js:406:11)
    at writeOrBuffer (_stream_writable.js:394:5)
    [... lines matching original stack trace ...]
    at c:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\async\dist\async.js:4082:9
[Error - 10:24:01] Connection to server got closed. Server will not be restarted.
[Error - 10:24:01] Request textDocument/codeAction failed.
Error: Connection got disposed.
	at Object.dispose (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\main.js:825:25)
	at Object.dispose (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-languageclient\lib\client.js:57:35)
	at LanguageClient.handleConnectionClosed (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-languageclient\lib\client.js:1954:42)
	at LanguageClient.handleConnectionClosed (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-languageclient\lib\main.js:126:15)
	at closeHandler (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-languageclient\lib\client.js:1941:18)
	at CallbackList.invoke (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\events.js:71:39)
	at Emitter.fire (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\events.js:135:36)
	at closeHandler (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\main.js:221:26)
	at CallbackList.invoke (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\events.js:71:39)
	at Emitter.fire (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\events.js:135:36)
	at IPCMessageReader.AbstractMessageReader.fireClose (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\messageReader.js:135:27)
	at ChildProcess.<anonymous> (C:\Users\soegtrop\.vscode\extensions\freebroccolo.reasonml-1.0.38\node_modules\vscode-jsonrpc\lib\messageReader.js:253:61)
	at ChildProcess.emit (events.js:187:15)
	at maybeClose (internal/child_process.js:961:16)
	at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mnxncommented, May 5, 2019

@MSoegtropIMC @cqfllp This sounds related to #236

Try setting reason.path.ocamlmerlin to “ocamlmerlin-server”

0reactions
MSoegtropIMCcommented, May 5, 2019

P.S.: There is one more caveat: I found that sometimes VSCode leaves hidden processes after closing and if it is started from the command line, it might pick up this hidden process rather than creating a new one. This has the effect that VSCode has the wrong environment, notably possibly a wrong path without ocamlmerlin-server. In case you have unreproducible errors, open a terminal from VSCode and inspect that PATH. If the PATH is wrong, close VSCode, check that there are no VSCode processes left (or kill them) and restart.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Error: Connection got disposed" on save · Issue #247 - GitHub
When I try to save a file I get the following error output: [Error - 4:14:31 PM] Connection to server got closed. Server...
Read more >
Micro Motion 5700 Transmitters with Configurable Inputs and ...
Troubleshooting information can be found in the configuration manual. Product data sheets and manuals are available from the Micro Motion web site at...
Read more >
with 3500 Series Data Collection Software 3.1
The information in this guide is subject to change without notice. DISCLAIMER. TO THE EXTENT ALLOWED BY LAW, LIFE TECHNOLOGIES AND/OR ITS AFFILIATE(S)...
Read more >
Receiving error message 'Extension host terminated ...
When I open developer tools, this is what I find in the console. Running vscode from command prompt with Code.exe --disable-extensions doesn't ...
Read more >
USB Protocol Suite User Manual - Teledyne LeCroy
This electronic product is subject to disposal and recycling regulations that vary by country and region. Many countries prohibit the disposal of.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found