fdimuccio / play2-sockjs

A SockJS server implementation for Play Framework.
Apache License 2.0
62 stars 11 forks source link

WebSocket actor crashes for large payloads #26

Open uvinw opened 6 years ago

uvinw commented 6 years ago

This issue only happens on the websocket protocol. On XHR streaming, the large payload is passed through to the Sock Actor without an issues. The JSON payload I am sending is 0.5 MB in size.

The following can be observed: [debug] c.k.c.a.SockActor - Actor started: akka://play-dev-mode/user/StreamSupervisor-0/$$i [debug] c.k.c.a.SockActor - Actor ended: akka://play-dev-mode/user/StreamSupervisor-0/$$i

I am provisioning the actor as follows:

private static final int STREAMING_QUOTA = 4096;
private static final int SIXTEEN = 16;

@Inject
public SockActorController(ActorSystem actorSystem) {
    this.actorSystem = actorSystem;
}

@Override
public SockJSSettings settings() {
    return new SockJSSettings().withStreamingQuota(STREAMING_QUOTA);
}

@Override
public SockJS sockjs() {
    return SockJS.Json.accept(req -> ActorFlow.<JsonNode,
            JsonNode>actorRef(out -> SockActor.props(out),
            SIXTEEN,
            OverflowStrategy.dropNew(),
            actorSystem).asJava());
}

Is STREAMING_QUOTA the bottleneck here?