goblint / GobPie

Goblint IDE integration via MagpieBridge
MIT License
7 stars 4 forks source link

Using Goblint server mode #19

Closed karoliineh closed 2 years ago

karoliineh commented 2 years ago

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 commented 2 years ago

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."

"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.