Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge pull request #914 from marci4/Issue900 #914

Merged
merged 5 commits into from Jan 20, 2020

Conversation

marci4
Copy link
Collaborator

@marci4 marci4 commented Jul 3, 2019

Description

Due to refactoring when an IOException happens, the WebSocket was always null and therefore close was never called on it.

Related Issue

Fixes #900

Motivation and Context

Regression

How Has This Been Tested?

Currently only a manual test

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@marci4
Copy link
Collaborator Author

marci4 commented Jul 3, 2019

Currently looking for some input on how to test it (see #900) for more!

@marci4 marci4 requested a review from PhilipRoman July 10, 2019 20:51
@MichaelPote
Copy link

Please can this be merged?
It's been 6 months now and this is kind of a big failure of the library to not call onClose.

@marci4
Copy link
Collaborator Author

marci4 commented Nov 10, 2019

@MichaelPote feel free to write a test for this issue or contribute to the project in another way!

@MichaelPote
Copy link

@marci4 I've looked through the pull request and the test you wrote, but unfortunately I lack the context and understanding to contribute. It seems to me like you've provided a fix for the issue and written a test (https://gist.github.com/marci4/6b47a9475d440a3dcd0d5212095d5ab3) already?

@marci4
Copy link
Collaborator Author

marci4 commented Nov 11, 2019

@MichaelPote no, the test is not finished and I have no real idea on how to get this issue tested. The gist is just how far I got

Overwrite channel to always throw IOException
@marci4
Copy link
Collaborator Author

marci4 commented Jan 19, 2020

@PhilipRoman could you do a review in my changes. I found a way to test this issue!


@Override
public boolean isNeedWrite() {
return false;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this return true? Looking at

if( c.isNeedWrite() ) {
c.writeMore();
}

it seems that the writeMore() isn't actually called in this test. Or are you relying on other methods to throw the exception?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good point, I relied on the normal read/write call. Changing readMore/writeMore to true will however ensure better behavior

public class Issue900Test {

CountDownLatch countServerDownLatch = new CountDownLatch(1);
CountDownLatch countCloseCallsDownLatch = new CountDownLatch(1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These variables have confusing names. I think serverStartedLatch and serverStoppedLatch would be better.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@marci4 marci4 added this to the Release 1.4.1 milestone Jan 20, 2020
@marci4 marci4 changed the title Wrap IOException and include WebSocket Merge pull request #914 from marci4/Issue900 Jan 20, 2020
@marci4 marci4 merged commit b52faa4 into TooTallNate:master Jan 20, 2020
@marci4 marci4 deleted the Issue900 branch January 20, 2020 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OnClose is not called when client disconnect
3 participants