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

NPE in io.circe.Printer$PrintingFolder.onString from Client.processMessage( #5683

Closed
2 tasks
JaroslavTulach opened this issue Feb 17, 2023 · 8 comments · Fixed by #5715
Closed
2 tasks

NPE in io.circe.Printer$PrintingFolder.onString from Client.processMessage( #5683

JaroslavTulach opened this issue Feb 17, 2023 · 8 comments · Fixed by #5715
Assignees

Comments

@JaroslavTulach
Copy link
Member

Discord username

Jaroslav Tulach#1623

What type of issue is this?

Intermittent – Ocurring irregularly

Is this issue blocking you from using Enso?

  • Yes, I can't use Enso because of this issue.

Is this a regression?

  • Yes, previous version of Enso did not have this issue.

What issue are you facing?

While developing I am seeing:

java.lang.NullPointerException
        at io.circe.Printer$PrintingFolder.onString(Printer.scala:319)
        at io.circe.Printer$PrintingFolder.onString(Printer.scala:302)
        at io.circe.Json$JString.foldWith(Json.scala:364)
        at io.circe.JsonObject$LinkedHashMapJsonObject.appendToFolder(JsonObject.scala:343)
        at io.circe.Printer$PrintingFolder.onObject(Printer.scala:369)
        at io.circe.Printer$PrintingFolder.onObject(Printer.scala:302)
        at io.circe.Json$JObject.foldWith(Json.scala:426)
        at io.circe.Printer.unsafePrintToAppendable(Printer.scala:229)
        at io.circe.Printer.print(Printer.scala:197)
        at io.circe.Json.noSpaces(Json.scala:117)
        at org.enso.loggingservice.internal.service.Client.processMessage(Client.scala:91)
        at org.enso.loggingservice.internal.service.ThreadProcessingService.runQueue(ThreadProcessingService.scala:70)
        at org.enso.loggingservice.internal.service.ThreadProcessingService.$anonfun$startQueueProcessor$1(ThreadProcessingService.scala:50)
        at java.base/java.lang.Thread.run(Thread.java:829)

Expected behaviour

I have a feeling this is related to encoding exceptions with null message that cannot be serialized, but I am not able to verify that in debugger.

How we can reproduce it?

No response

Screenshots or screencasts

No response

Enso Version

dev as of Feb 17, 2023

Browser or standalone distribution

Chromium

Browser Version or standalone distribution

Browser

Operating System

Linux

Operating System Version

Ubuntu

Hardware you are using

AMD Radeon

@JaroslavTulach
Copy link
Member Author

Hubert, Radek, can you triage my bug report? Is it possible that null message could yield this error or am I totally off?

@JaroslavTulach
Copy link
Member Author

I am using following modification to obtain the exception:

enso$ git diff
diff --git a/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/Client.scala b/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/Client.scala
index b7ed6547a..6b4223b95 100644
--- a/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/Client.scala
+++ b/lib/scala/logging-service/src/main/scala/org/enso/loggingservice/internal/service/Client.scala
@@ -87,7 +87,14 @@ class Client(
         "the connection has been initialized."
       )
     )
-    val serializedMessage = message.asJson.noSpaces
+    val serializedMessage = try {
+        message.asJson.dropNullValues.noSpaces
+    } catch {
+        case npe: NullPointerException => {
+            npe.printStackTrace()
+            throw npe
+        }
+    }
     val offerResult       = queue.offer(TextMessage.Strict(serializedMessage))
     try {
       Await.result(offerResult, 30.seconds) match {

@radeusgd
Copy link
Member

When does this happen? Just randomly when using the IDE? Or is there any particular set of steps when it happens more often?

I'm not sure what can be null in the WSLogMessage, nothing should be as far as I can tell... Indeed would be good to try debugging it and finding more precisely where that null is lurking.

@JaroslavTulach
Copy link
Member Author

It happens randomly when I run the IDE & project-manager . I'll do a bit more debugging, if I catch the issues again. Thanks for taking a look.

@hubertp
Copy link
Collaborator

hubertp commented Feb 20, 2023

I think I saw something similar in the past when trying to visualize dataflow errors

@jdunkerley jdunkerley moved this from ❓New to 📤 Backlog in Issues Board Feb 21, 2023
@jdunkerley
Copy link
Member

Left with triage label as need to reproduce.

@JaroslavTulach
Copy link
Member Author

I think I saw something similar in the past when trying to visualize dataflow errors

Thanks for the encouragement. I have a reproducer.

@JaroslavTulach JaroslavTulach moved this from 📤 Backlog to 🔧 Implementation in Issues Board Feb 21, 2023
@enso-bot
Copy link

enso-bot bot commented Feb 22, 2023

Jaroslav Tulach reports a new STANDUP for yesterday (2023-02-21):

Progress: - bugfix of #5683: PR: #5715

Next Day: Working on SuggestionDB & other fixes

GitHub
Pull Request Description

Close #5068
Important Notes

Checklist
Please include the following checklist in your PR:

The documentation has been updated if necessary.
All code conforms to the
Scal...

@mergify mergify bot closed this as completed in #5715 Feb 22, 2023
mergify bot pushed a commit that referenced this issue Feb 22, 2023
Getting ready for `null` values in `WSLogMessage`. Closes #5683.
@github-project-automation github-project-automation bot moved this from 🔧 Implementation to 🟢 Accepted in Issues Board Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants