jMonkeyEngine / jMonkeyEngine/jmonkeyengine

Stack Trace Printed on Server When Kicking Client

Open
#411 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
4.3k
Forks
1.2k
Avg merge
4d 7h
Merged PRs (30d)
14

Description

Using the following ConnectionListener on the server I get the following error when a client is immediately kicked (I am using this to test that the kicking screen on the client works correctly):

import com.jme3.network.ConnectionListener;
import com.jme3.network.HostedConnection;
import com.jme3.network.Server;

public class ServerConnectionListener implements ConnectionListener{
    private final ServerNetworkState serverNetworkState;

    public ServerConnectionListener(ServerNetworkState serverNetworkState){
        this.serverNetworkState = serverNetworkState;
    }

    @Override
    public void connectionAdded(Server server, HostedConnection hostedConnection){
        hostedConnection.close("Incorrect Username or Password");
    }

    @Override
    public void connectionRemoved(Server server, HostedConnection hostedConnection){

    }

}

Feb 12, 2016 6:54:32 PM com.jme3.network.base.KernelAdapter reportError
SEVERE: Unhandled error, endpoint:UdpEndpoint[2, /127.0.0.1:50700], context:Envelope[UdpEndpoint[2, /127.0.0.1:50700], unreliable, 18]
com.jme3.network.kernel.KernelException: Endpoint has been closed:java.nio.channels.SocketChannel[connected local=/127.0.0.1:16384 remote=/127.0.0.1:41380]
    at com.jme3.network.kernel.tcp.NioEndpoint.send(NioEndpoint.java:171)
    at com.jme3.network.base.DefaultServer$Connection.send(DefaultServer.java:584)
    at com.jme3.network.base.DefaultServer.registerClient(DefaultServer.java:454)
    at com.jme3.network.base.KernelAdapter.dispatch(KernelAdapter.java:173)
    at com.jme3.network.base.KernelAdapter.createAndDispatch(KernelAdapter.java:241)
    at com.jme3.network.base.KernelAdapter.run(KernelAdapter.java:284)

The client still gets kicked and the server continues functioning without any apparent error. This stack trace is the only symptom of the issue.

EDIT: The issue doesn't occur if the server doesn't immediately kick the player when they join. There are legitimate scenarios (ie. ip banning) in which it may be beneficial to do so.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the immediate-kick path through com.jme3.network.base.KernelAdapter, DefaultServer, and com.jme3.network.kernel.tcp.NioEndpoint, using the reported NioEndpoint.send stack trace as the entry point. Reproduce a client being closed from connectionAdded and compare it with a delayed kick. Done means the client is kicked and the server continues functioning without printing this expected endpoint-closed stack trace.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.