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

Using Goblint server mode #19

Merged
merged 14 commits into from
Feb 28, 2022
Merged

Using Goblint server mode #19

merged 14 commits into from
Feb 28, 2022

Conversation

karoliineh
Copy link
Member

GobPie is now using the server mode. Currently, it is only sending requests but does not receive any results from Goblint (only redirects Goblint's stdout and stderr into the terminal as it did before). Is it necessary to do something with the response? If yes, then what?

For some unknown reason, sometimes the analysis did not go past the command execution when I tried it out on the DemoProject. When it "freezed" like that, it did not trigger a new analysis when saving a file either. I have no idea, why this happens, though, because after closing the project and opening it again, everything works again. 🤔

Also, running Goblint in server mode (with the latest version on the master branch) did not generate the results JSON for me. It is just empty. The command I used was:
goblint --conf goblint.json --enable server.enabled --set server.mode unix --set server.unix-socket goblint.sock --set result json-messages -o analysisResults.json ./build

I changed the java version to 17 now, because the Unix domain sockets were added to the socket channel API in Java 16. I also renamed the original "goblintanalyzer" to "gobpie" everywhere I could find.

@karoliineh karoliineh added the enhancement New feature or request label Feb 16, 2022
@karoliineh karoliineh linked an issue Feb 16, 2022 that may be closed by this pull request
pom.xml Outdated Show resolved Hide resolved
src/main/java/goblintserver/GoblintServer.java Outdated Show resolved Hide resolved
src/main/java/analysis/GoblintAnalysis.java Show resolved Hide resolved
src/main/java/goblintserver/GoblintClient.java Outdated Show resolved Hide resolved
src/main/java/analysis/GoblintAnalysis.java Outdated Show resolved Hide resolved
import goblintserver.GoblintClient;
import goblintserver.GoblintServer;

import org.eclipse.lsp4j.jsonrpc.messages.Either;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooh! Apparently there already is some JSON-RPC library around. Maybe at a later point we should switch to using that then.

@karoliineh
Copy link
Member Author

karoliineh commented Feb 19, 2022

So I got answers to the previous questions I had:

"For some unknown reason, sometimes the analysis did not go past the command execution when I tried it out on the DemoProject."

  • This was due to the fact that the program continued on and did not wait for the server to finish its startup. Therefore the goblint.sock file wasn't created before the program tried to read it and that caused it to get stuck.

"Also, running Goblint in server mode (with the latest version on the master branch) did not generate the results JSON for me."

  • This is due to the fact that calling goblint with --set server.mode unix does not generate the results json, but should give the results through the socket instead.

Although most problems got solved, I did stumble upon some new ones.

  1. Sending the analyze request in the current implementation gives an error. The same request did work when I tried it with goblint on the command line, though.
  2. Sending the method request does not give any results. This was the case when trying it with goblint on the command line as well. Therefore there is no way for me to read the results from anywhere right now, not from the generated .json or the request JSON.
19:13:04.453 INFO  - Request {"jsonrpc":"2.0","id":0,"method":"analyze"} written to socket.
19:13:04.454 INFO  - Result {"id":0,"jsonrpc":"2.0","error":{"code":-32602,"message":"Server.params"}} read from socket.
19:13:04.454 INFO  - Request  {"jsonrpc":"2.0","id":0,"method":"messages"} written to socket.
19:13:04.455 INFO  - Result {"id":0,"jsonrpc":"2.0","result":[]} read from socket.

I managed to get two different kinds of errors when playing around with the requests. One was with code -32601 and the other with code -32602. Is there any documentation, where I could check what these codes mean? Googling did not give any results for me.

Never mind, this is all good. I was missing the params attribute in the JSON. Adding this resolved all. Michael directed me to the error codes documentation as well. I should probably handle those in code as well.

@karoliineh karoliineh merged commit 319e3f6 into master Feb 28, 2022
@karoliineh karoliineh deleted the server-mode branch February 28, 2022 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Goblint server mode
2 participants