RamSaw / SoftwareDesign

Repository for software design course assignments
MIT License
0 stars 1 forks source link

Exception when player leaves before his move #14

Closed vladimirrim closed 5 years ago

vladimirrim commented 5 years ago

When 3 player join session and second leaves when it is first player turn, server stuck waiting for second player.

Expected: Turn for third player

Actual:

SEVERE: Exception while executing runnable io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1MessagesAvailable@73a3a5dc
io.grpc.StatusRuntimeException: CANCELLED: call already cancelled
    at io.grpc.Status.asRuntimeException(Status.java:524)
    at io.grpc.stub.ServerCalls$ServerCallStreamObserverImpl.onNext(ServerCalls.java:339)
    at ru.hse.spb.server.RoguelikeServer$ConnectionSetUpperImpl.sendModelToAllPlayers(RoguelikeServer.kt:57)
    at ru.hse.spb.server.RoguelikeServer$ConnectionSetUpperImpl.sendModelToAllPlayers$default(RoguelikeServer.kt:52)
    at ru.hse.spb.server.RoguelikeServer$ConnectionSetUpperImpl$communicate$1.onNext(RoguelikeServer.kt:88)
    at ru.hse.spb.server.RoguelikeServer$ConnectionSetUpperImpl$communicate$1.onNext(RoguelikeServer.kt:62)
    at io.grpc.stub.ServerCalls$StreamingServerCallHandler$StreamingServerCallListener.onMessage(ServerCalls.java:249)
    at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.messagesAvailable(ServerCallImpl.java:297)
    at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1MessagesAvailable.runInContext(ServerImpl.java:738)
    at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
    at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
RamSaw commented 5 years ago

image

This is situation after second player leaving. After his leaving the turn goes to the next player - third. So it doesn't stay at the same player. I would say it not a bug it is a feature. Feature of our game implementation. Do not see anything terrible in this behavior, our users will get used to these rules. @vladimirrim your thoughts? and ideas how to reproduce this exception.

vladimirrim commented 5 years ago

Same as #13, bug appears when you disconnect by killing client process.