Skip to content

Socket RPC calls have no timeout, they can hang forever #2

Description

@CanReader

Every method in SocketRpcClient.java follows the same pattern:

CompletableFuture<T> result = new CompletableFuture<>();
socket.emit(EVENT, args, (Ack) args -> { result.complete(...); });
return result;

None of these have a timeout. If the ack never comes back, dropped connection mid request, server restarts, or literally the exact case checkSessionPassword's own comment calls out ("An older server has no handler for this event and never acks"), the future just sits there forever. Nothing ever calls completeExceptionally or times it out on its own.

This hits basically the whole file: getDBUserBuildingsViaSocket, getSessionListViaSocket, getSessionViaSocket, getSessionMessagesViaSocket, getSessionUsersViaSocket, getFriends, searchUsers, all four friendAction wrappers (send/accept/reject/remove friend), checkSessionPassword, and buyBuilding.

Whatever is waiting on one of these (a loading spinner, a disabled buy button, the friends panel) just hangs indefinitely with no way to recover unless something else notices and reconnects the socket. Feels like these should all get a reasonable timeout, something like orTimeout(10, TimeUnit.SECONDS) so they fail loud instead of hanging silently forever.

File: core/src/com/focus/kingdom/network/socket/SocketRpcClient.java, applies to basically every method in the file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions