Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

Logging in after failed attempt results in application hanging #23

Closed
paddatrapper opened this issue Jun 19, 2015 · 5 comments
Closed
Labels
Milestone

Comments

@paddatrapper
Copy link
Owner

Steps to reproduce:

  1. Login with the incorrect password.
  2. Acknowledge the "failed log in"
  3. Attempt to log in again with correct details
@nkarasch
Copy link
Contributor

I don't have a solution, but I've narrowed in on what is happening. The ClientConnectionThread thread is dying and not getting reopened. Is this intentional? Is there supposed to be a new connection for every request?

Adding this sloppy change to ServerConnection#getResponse "fixes" the issue, or so it seems. I'm a bit confused, I'll leave this up to you. If you didn't know this was happening I hope this leads you to finding the cure.

    private Response getResponse(Request request) throws IOException, ClassNotFoundException {
        writeOut(request);
        Response response = (Response) in.readObject();
        if(response.getStatus() != 200){
            open("localhost", 1244);
            return null;
        }
        return response;
    }

@paddatrapper
Copy link
Owner Author

You're right in thinking there should be a new ClientConnectionThread for each client. This does help and I'll take a better look at it tomorrow, but my feeling is that the connection to the server is being closed when the first login fails and then not being re-opened. Perhaps the solution is to open and close the connection to the server upon every request like is done for the Database

@nkarasch
Copy link
Contributor

I know there should be a new one for each client, but should there be a new one for every request a client submits?

@paddatrapper
Copy link
Owner Author

@nkarasch No there shouldn't. 1 thread should manage 1 client for the entirety of the time that the client is running

@paddatrapper
Copy link
Owner Author

Ok I've done some digging and it looks like this is because the AuthenticationException is caught outside of the thread loop in the ClientConnectionThread. I have corrected it, but as I have done some refactoring of that class for PR #24 I will add the fix to that.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants