Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension is not running and validating .xml file #856

Closed
MarcelGeo opened this issue Jan 12, 2023 · 16 comments
Closed

Extension is not running and validating .xml file #856

MarcelGeo opened this issue Jan 12, 2023 · 16 comments

Comments

@MarcelGeo
Copy link

MarcelGeo commented Jan 12, 2023

VSCODE:
version: 1.74.2
EXTENSION:
version: 0.23.0

Error:

[Error - 13:01:35] jan 12, 2023 01:01:35 org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError()
Message: Missing header Content-Length in input "{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///c%3A/Users/marcel.kocisek/OneDrive%20-%20stengl%20a.s/Documents/Reporting2018/fhrm.xml","version":6},"contentChanges":[{"range":{"start":{"line":4,"character":20},"end":{"line":5,"character":4}},"rangeLength":6,"text":""}]}}Content-Length: 180

"
java.lang.IllegalStateException: Missing header Content-Length in input "{"jsonrpc":"2.0","method":"textDocument/didChange","params":{"textDocument":{"uri":"file:///c%3A/Users/marcel.kocisek/OneDrive%20-%20stengl%20a.s/Documents/Reporting2018/fhrm.xml","version":6},"contentChanges":[{"range":{"start":{"line":4,"character":20},"end":{"line":5,"character":4}},"rangeLength":6,"text":""}]}}Content-Length: 180

"
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:91)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

File:

http<?xml version="1.0" encoding="utf-8"?>
<?xml-model href="https://dd.eionet.europa.eu/schemas/Floods/" type="application/xml"?>
<?xml-model href="https://dd.eionet.europa.eu/schemas/Floods/FHRM.xsd" type="application/xml"?>
<FHRM xmlns="http://dd.eionet.europa.eu/schemas/Floods" xmlns:fd="http://dd.eionet.europa.eu/schemas/Floods/FDcommon" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="https://dd.eionet.europa.eu/schemas/Floods/ https://dd.eionet.europa.eu/schemas/Floods/FHRM.xsd" CreationDate="2014-02-14" Creator="Slovak Water Management Enterpise, state owned" Email="[email protected]" Language="sk" Description="Slovenský vodohospodársky podnik">
    <hejno>d</hejno>
</FHRM>
@angelozerr
Copy link
Contributor

I cannot reproduce it It seems that it is a problem from https://github.com/eclipse/lsp4j

We need to investigate how we can reproduce this issue.

@MarcelGeo
Copy link
Author

We could make video call ?

@angelozerr
Copy link
Contributor

@angelozerr
Copy link
Contributor

I don't know if it is related to your path file:///c%3A/Users/marcel.kocisek/OneDrive%20-%20stengl%20a.s/Documents/Reporting2018/fhrm.xml

Could you please copy/paste your fhrm.xml in your C folder directory and open it. Is it working better?

@rgrunber
Copy link
Member

Assuming you're able to hit this issue consistently, @MarcelGeo , can you try the following to see if it resolves the issue :

Under settings, for xml.server.vmargs, set the following value : -Xmx64M -Xlog:disable . If you already use your own custom setting there, just add -Xlog:disable to the end. Let us know if that fixes anything.

@MarcelGeo
Copy link
Author

Thanks for answers. I will try it on monday.

@MarcelGeo
Copy link
Author

@angelozerr Moving file to C caused the same error:

[Error - 8:51:19] jan 16, 2023 08:51:19 org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError()
Message: Missing header Content-Length in input "{"jsonrpc":"2.0","method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///c%3A/fhrm.xml"}}}Content-Length: 107

"
java.lang.IllegalStateException: Missing header Content-Length in input "{"jsonrpc":"2.0","method":"textDocument/didSave","params":{"textDocument":{"uri":"file:///c%3A/fhrm.xml"}}}Content-Length: 107

"
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:91)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)

@rgrunber The same error after changing vmargs to: "xml.server.vmargs": "-Xmx128M -Xlog:disable"

This is initial log for XML extension after open first XML file (maybe this will be problem):

[Info - 8:56:08] jan 16, 2023 08:56:08 org.eclipse.lemminx.XMLLanguageServer initialize()
Message: Initializing XML Language server
LemMinX Server info:

  • Version : 0.23.2
  • Java : C:\PROGRA1\ADOPTO1\JDK-11~1.10-
  • VM Version : 11.0.8
  • Git b699556 - [maven-release-plugin] prepare release 0.23.2
    [Error - 8:56:08] jan 16, 2023 08:56:08 org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError()
    Message: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
    com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
    at com.google.gson.Gson.fromJson(Gson.java:1226)
    at com.google.gson.Gson.fromJson(Gson.java:1173)
    at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:119)
    at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:114)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:193)
    at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
    at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
    Caused by: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 1 path $
    at com.google.gson.stream.JsonReader.beginObject(JsonReader.java:393)
    at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.read(MessageTypeAdapter.java:92)
    at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.read(MessageTypeAdapter.java:55)
    at com.google.gson.Gson.fromJson(Gson.java:1214)
    ... 11 more

@angelozerr
Copy link
Contributor

Could you try to force use of binary with adding in your settings.json "xml.server.preferBinary": true

@MarcelGeo
Copy link
Author

image
The same issue with this option enabled.

@angelozerr
Copy link
Contributor

Could you share your trace server please by activating binary. Thanks

@angelozerr
Copy link
Contributor

Could you share your settings.json please. Thanks

@angelozerr
Copy link
Contributor

Could you create a simple xml like

<foo

It should show you an error.

@rgrunber
Copy link
Member

One thing I noticed is that your Content-Length header is coming after the content part of the message. This definitely doesn't seem right. According to https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#baseProtocol, it should be coming before.

@angelozerr seems this is kind of similar to eclipse-lsp4j/lsp4j#616 ?

@MarcelGeo
Copy link
Author

Hi guys.

I dont now. After update VSCode to version 1.74.3 problem is NOT OCCURED . Sorry for your time.

@angelozerr
Copy link
Contributor

Hi @MarcelGeo

Glad to see that your issue is fixed now by updating vscode. I suspect that it was problem with encoding, but now if it is working, that's great.

Hope you will enjoy with vscode-xml.

@rgrunber
Copy link
Member

I'm not really seeing anything in microsoft/vscode@1.74.2...1.74.3 that would have fixed this :\ but perhaps it's some kind of encoding issue on the client side ? Also see microsoft/vscode-languageserver-node#917 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants