LSP in VS code causes OpenHAB restart

Hi,

Yesterday I upgraded my system to 2.4.0 M4.
I noticed that when I use VS Code with the OpenHAB extension it causes a reboot of my OpenHAB instance when I close VS Code.
I’m running on a Windows Server 2012 OS. Also VS Code is running on the same system.
The installed Java version is JDK 8 Update 181, 64 bit.
When I disable LSP in the settings of the extension, the problem does not occur.

I tried to enable some TRACE logging on al related LSP components in OpenHAB but I couldn’t find anything usefull in the log files:

  • org.eclipse.lsp4j
  • org.eclipse.smarthome.model.lsp
  • org.eclipse.lsp4j.jsonrpc

The only thing I saw in the log file is:

2018-09-26 21:15:04.133 [DEBUG] [thome.model.lsp.internal.ModelServer] - Going to wait for a client to connect
2018-09-26 21:15:04.151 [DEBUG] [thome.model.lsp.internal.ModelServer] - Client /127.0.0.1:65071 connected
2018-09-26 21:15:05.035 [DEBUG] [el.lsp.internal.MappingUriExtensions] - Identified client workspace as 'file:///c:/OpenHAB/conf'
2018-09-26 21:15:05.037 [TRACE] [el.lsp.internal.MappingUriExtensions] - Going to map path file:///C:/OpenHAB/conf
2018-09-26 21:15:05.038 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapped path file:///c:/OpenHAB/conf to file:///C:/OpenHAB/conf/
2018-09-26 21:15:15.709 [TRACE] [el.lsp.internal.MappingUriExtensions] - Going to map path file:///C:/OpenHAB/conf/rules/entertainment.rules
2018-09-26 21:15:15.710 [TRACE] [el.lsp.internal.MappingUriExtensions] - Mapped path file:///c:/OpenHAB/conf/rules/entertainment.rules to file:///C:/OpenHAB/conf/rules/entertainment.rules
2018-09-26 21:15:16.033 [TRACE] [el.lsp.internal.MappingUriExtensions] - Going to map path file:///C:/OpenHAB/conf/rules/entertainment.rules

After this I only see OpenHAB restarting:

2018-09-26 21:16:15.281 [INFO ] [rt.modbus.internal.ModbusManagerImpl] - Modbus manager activated
2018-09-26 21:16:15.833 [DEBUG] [org.eclipse.lsp4j.jsonrpc           ] - BundleEvent STARTING - org.eclipse.lsp4j.jsonrpc
2018-09-26 21:16:15.835 [DEBUG] [org.eclipse.lsp4j.jsonrpc           ] - BundleEvent STARTED - org.eclipse.lsp4j.jsonrpc
2018-09-26 21:16:16.216 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2018-09-26 21:16:17.649 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring XXX.XXX.XXX.1
2018-09-26 21:16:18.450 [WARN ] [g.eclipse.smarthome.core.net.NetUtil] - Found multiple local interfaces - ignoring XXX.XXX.XXX.1
2018-09-26 21:16:19.096 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://XXX.XXX.XXX.101:8080
2018-09-26 21:16:19.097 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://XXX.XXX.XXX.XXX:8443

I don’t where else to look for a solution.

Greetings,
Frederic

I only started using VS Code today, so I didn’t realise that the restart wasn’t intentional.

Same thing here on a Ubuntu server 18.04 for Ubuntu
And VS Code installed on Ubuntu 18.04 Desktop

EDIT: I am on zulu java

Ok, so it seems to be a bug.
LSP is part of Eclipse Smarthome, right?
I will log an issue over there.

@kubawolanin, just wanted to bring your attention here. Seems like closing VSCode is causing OH to restart since at least OH.M4.

What I’m seeing on build 1372 is that the openHAB Java process exits when VS Code is closed, or when you close the conf folder in VS Code (which likely has the same effect as closing VS Code).

Edit: I’m not seeing this behavior on 1368.

Edit: I put the following LSP bundles in TRACE mode, and nothing is logged when you exit VS Code .

 94 x Active   x  80 x 0.4.1.v20180515-1321   x org.eclipse.lsp4j
 95 x Active   x  80 x 0.4.1.v20180515-1321   x org.eclipse.lsp4j.jsonrpc
129 x Active   x  80 x 0.10.0.201809210646    x org.eclipse.smarthome.model.lsp

Edit: In the interest of full disclosure, I’m running OpenJDK.

openjdk version "1.8.0_181"
OpenJDK Runtime Environment (build 1.8.0_181-8u181-b13-0ubuntu0.16.04.1-b13)
OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)
1 Like

I see that LSP has been updated to a new version recently (on September 21th):


Probably something needs to be updated in the VS Code extension.

I just opened an issue. Feel free to add any additional information to that issue.

Oh, ok, I was waiting for confirmation that Smarthome was indeed the correct repo to log the issue.
Thanks!