obsidiansystems / ex-healthcare-claims-processing

Reference DAML application demonstrating a healthcare use case.
Apache License 2.0
0 stars 1 forks source link

Encountering an issue with Websocket connections failing #83

Open anthonylusardi-da opened 3 years ago

anthonylusardi-da commented 3 years ago

This happens in multiple parts of the workflow but for example when clicking on a patient's Appointment to check them in as a Radiologist I'll get a useStreamQueries: WebSocket connection failed. error in Chrome's dev console. Here you can see the error with lacking an appointmentId. I'll see similar errors for treatmentId and others.

13:42:47.514 [http-json-ledger-api-akka.actor.default-dispatcher-12] ERROR akka.actor.ActorSystemImpl - Websocket handler failed with f31f98aa22e64ae2fd12dd9dc4900f6f4c1ef982e355cc24ebea685621729d6d:Main.Appointment:Appointment does not have fields Set(appointmentId)
java.lang.RuntimeException: f31f98aa22e64ae2fd12dd9dc4900f6f4c1ef982e355cc24ebea685621729d6d:Main.Appointment:Appointment does not have fields Set(appointmentId)
    at scala.sys.package$.error(package.scala:30)
    at com.daml.http.query.ValuePredicate$.com$daml$http$query$ValuePredicate$$predicateParseError(ValuePredicate.scala:474)
    at com.daml.http.query.ValuePredicate$.com$daml$http$query$ValuePredicate$$fromRecord$1(ValuePredicate.scala:258)
    at com.daml.http.query.ValuePredicate$.$anonfun$fromJsObject$14(ValuePredicate.scala:339)
    at scala.Option.map(Option.scala:230)
    at com.daml.http.query.ValuePredicate$.$anonfun$fromJsObject$13(ValuePredicate.scala:338)
    at scala.Option.flatMap(Option.scala:271)
    at com.daml.http.query.ValuePredicate$.fromJsObject(ValuePredicate.scala:337)
    at com.daml.http.query.ValuePredicate$.fromTemplateJsObject(ValuePredicate.scala:220)
    at com.daml.http.WebSocketService$$anon$1.$anonfun$prepareFilters$1(WebSocketService.scala:243)
    at scala.collection.Iterator$$anon$10.next(Iterator.scala:461)
    at scala.collection.Iterator.foreach(Iterator.scala:943)
    at scala.collection.Iterator.foreach$(Iterator.scala:943)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1431)
    at scala.collection.generic.Growable.$plus$plus$eq(Growable.scala:62)
    at scala.collection.generic.Growable.$plus$plus$eq$(Growable.scala:53)
    at scala.collection.immutable.Map$MapBuilderImpl.$plus$plus$eq(Map.scala:647)
    at scala.collection.immutable.Map$MapBuilderImpl.$plus$plus$eq(Map.scala:594)
    at scala.collection.TraversableOnce.toMap(TraversableOnce.scala:372)
    at scala.collection.TraversableOnce.toMap$(TraversableOnce.scala:370)
    at scala.collection.AbstractIterator.toMap(Iterator.scala:1431)
    at com.daml.http.WebSocketService$$anon$1.prepareFilters(WebSocketService.scala:245)
    at com.daml.http.WebSocketService$$anon$1.$anonfun$predicate$1(WebSocketService.scala:204)
    at scalaz.NonEmptyListInstances$$anon$1.foldMap1(NonEmptyList.scala:185)
    at scalaz.NonEmptyListInstances$$anon$1.foldMap1(NonEmptyList.scala:169)
    at scalaz.Foldable1.foldMap(Foldable1.scala:35)
    at scalaz.Foldable1.foldMap$(Foldable1.scala:34)
    at scalaz.NonEmptyListInstances$$anon$1.foldMap(NonEmptyList.scala:169)
    at scalaz.syntax.FoldableOps.foldMap(FoldableSyntax.scala:11)
    at com.daml.http.WebSocketService$$anon$1.predicate(WebSocketService.scala:201)
    at com.daml.http.WebSocketService$$anon$1.predicate(WebSocketService.scala:176)
    at com.daml.http.WebSocketService.getTransactionSourceForParty(WebSocketService.scala:474)
    at com.daml.http.WebSocketService.$anonfun$wsMessageHandler$10(WebSocketService.scala:443)
    at scalaz.$bslash$div.map(Either.scala:112)
    at com.daml.http.WebSocketService.$anonfun$wsMessageHandler$9(WebSocketService.scala:441)
    at akka.stream.impl.fusing.Map$$anon$1.onPush(Ops.scala:52)
    at akka.stream.impl.fusing.GraphInterpreter.processPush(GraphInterpreter.scala:541)
    at akka.stream.impl.fusing.GraphInterpreter.execute(GraphInterpreter.scala:423)
    at akka.stream.impl.fusing.GraphInterpreterShell.runBatch(ActorGraphInterpreter.scala:625)
    at akka.stream.impl.fusing.GraphInterpreterShell$AsyncInput.execute(ActorGraphInterpreter.scala:502)
    at akka.stream.impl.fusing.GraphInterpreterShell.processEvent(ActorGraphInterpreter.scala:600)
    at akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:773)
    at akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:788)
    at akka.actor.Actor.aroundReceive(Actor.scala:537)
    at akka.actor.Actor.aroundReceive$(Actor.scala:535)
    at akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:691)
    at akka.actor.ActorCell.receiveMessage(ActorCell.scala:577)
    at akka.actor.ActorCell.invoke(ActorCell.scala:547)
    at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:270)
    at akka.dispatch.Mailbox.run(Mailbox.scala:231)
    at akka.dispatch.Mailbox.exec(Mailbox.scala:243)
    at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
    at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
    at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
    at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
    at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:177)
Ericson2314 commented 3 years ago

@anthonylusardi-da I have seen this a few times myself. Is there a more user-facing problem that goes with it? I didn't see any obvious correlation when I noticed before, but want to double check in case it helps me debug this.

anthonylusardi-da commented 3 years ago

No user facing issues from what I can tell.

On Thu, Jun 3, 2021, 3:05 AM John Ericson @.***> wrote:

@anthonylusardi-da https://github.com/anthonylusardi-da I have seen this a few times myself. Is there a more user-facing problem that goes with it? I didn't see any obvious correlation when I noticed before, but want to double check before I dive deeper into this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/obsidiansystems/ex-healthcare-claims-processing/issues/83#issuecomment-853671651, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOG2KEHVRFKAXU36CQSTJQTTQ4ZT5ANCNFSM455GQO5Q .

-- This message, and any attachments, is for the intended recipient(s) only, may contain information that is privileged, confidential and/or proprietary and subject to important terms and conditions available at  http://www.digitalasset.com/emaildisclaimer.html http://www.digitalasset.com/emaildisclaimer.html. If you are not the intended recipient, please delete this message.

richardkapolnai-da commented 3 years ago

The following may happen, approximately in this order

  1. JS queries the appointmentId, it will arrive later
  2. JS queries Appointments with undefined appointmentId
  3. ledger replies with an error
  4. the appointmentId arrives
  5. JS now makes another request, which is valid this time, hence no error realized by the user
anthonylusardi-da commented 3 years ago

Is there a solution to this?

Ericson2314 commented 3 years ago

I was looking at https://github.com/digital-asset/ex-healthcare-claims-processing/blob/af5ac5257ee1703a5fc911c4f56bd0f3dfa87639/ui/src/components/Appointments.tsx#L31-L59 where it looked like what @richardkapolnai-da was describing would play out, but i didn't immediately see an issue because there is a bunch of defense ternary operator already. Or is the issue something about the query being passed in?