Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

Subscription notification fails and WebSocket connection gets closed. #455

Open
@guilhermeblanco

Description

@guilhermeblanco

Describe the bug
Subscription notification fails and WebSocket connection gets closed.

To Reproduce
I'd love to describe how, but unfortunately, I have absolutely no information.
Here is the only information I have available at DEBUG level logging:

DEBUG 1 --- [nio-8080-exec-8] g.k.servlet.GraphQLWebsocketServlet      : Session closed: 2, CloseReason: code [1000], reason [null]

Expected behavior
Notification to be received, either containing the error or a log information on what happened.
Client simply receives a disconnect from WebSocket, cancelling all subscriptions (and not only the one failing). I'd expect to see a message flowing with the errors being populated, getting a more reliable source of information than "null" as close reason.

Additional information
Most of the times, implementation works as intended. But few times this error occurred and I have absolutely no information on what happened.

The full logs for the scenario is:

2020-09-04 19:57:10.566 DEBUG 1 --- [nio-8080-exec-9] g.k.servlet.GraphQLWebsocketServlet      : Session opened: 2, org.apache.tomcat.websocket.server.WsPerSessionServerEndpointConfig@4e0142e9
2020-09-04 19:57:10.600 DEBUG 1 --- [io-8080-exec-10] .e.s.a.SubscriptionConnectionInitCommand : Apollo subscription connection init: 2
2020-09-04 19:57:10.600 DEBUG 1 --- [io-8080-exec-10] s.r.g.e.AuthenticationConnectionListener : Calling my implementation of ApolloSubscriptionConnectionListener::onConnect: graphql.kickstart.execution.subscriptions.apollo.OperationMessage@883a367
2020-09-04 19:57:10.605 DEBUG 1 --- [io-8080-exec-10] g.k.e.s.apollo.SubscriptionStartCommand  : Apollo subscription start: 2 --> {variables={}, extensions={}, operationName=TrackedAuctionLaneUpdates, query=subscription TrackedAuctionLaneUpdates {
  trackedAuctionLaneUpdates {
    id
    name
    liveAuctionItem {
      id
    }
  }
}
}
2020-09-04 19:57:10.605 DEBUG 1 --- [io-8080-exec-10] s.r.g.e.AuthenticationConnectionListener : Calling my implementation of ApolloSubscriptionConnectionListener::onStart: graphql.kickstart.execution.subscriptions.apollo.OperationMessage@4ef26345
2020-09-04 19:57:10.608  INFO 1 --- [io-8080-exec-10] c.e.s.r.g.s.u.UserSessionSubscription    : Calling my implementation of SubscriptionResolver: trackedAuctionLaneUpdates
2020-09-04 19:57:10.611 DEBUG 1 --- [io-8080-exec-10] g.k.e.subscriptions.SessionSubscriber    : Subscribe to execution result: graphql.execution.reactive.DelegatingSubscription@56e8d8f9
2020-09-04 19:57:30.649 DEBUG 1 --- [nio-8080-exec-8] g.k.servlet.GraphQLWebsocketServlet      : Session closed: 2, CloseReason: code [1000], reason [null]
2020-09-04 19:57:40.604 DEBUG 1 --- [pool-1-thread-1] .e.s.a.ApolloSubscriptionKeepAliveRunner : Session 2 appears to be closed. Aborting keep alive

WS close only happens when a message is expected to be sent to client.

I see that in several places errors seems to be swallowed or just not reported. One example is https://github.com/graphql-java-kickstart/graphql-java-servlet/blob/master/graphql-java-servlet/src/main/java/graphql/kickstart/servlet/subscriptions/WebSocketSendSubscriber.java#L36, the implementation is impossible to be customized, as it's instantiated at https://github.com/graphql-java-kickstart/graphql-java-servlet/blob/master/graphql-java-servlet/src/main/java/graphql/kickstart/servlet/GraphQLWebsocketServlet.java#L132
I'm more than welcome to go over this specific scenario, attempt patches or anything similar, Gitter might be a good place to talk about this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions