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

Encountering an issue with Websocket connections failing #83

Open
anthonylusardi-da opened this issue Jun 1, 2021 · 5 comments
Open

Comments

@anthonylusardi-da
Copy link

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
Copy link
Member

Ericson2314 commented Jun 3, 2021

@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
Copy link
Author

anthonylusardi-da commented Jun 3, 2021 via email

@richardkapolnai-da
Copy link

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
Copy link
Author

Is there a solution to this?

@Ericson2314
Copy link
Member

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?

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