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

Fix #154 - relay dies with AssertionError #209

Closed
wants to merge 1 commit into from

Conversation

jessedusty
Copy link

@jessedusty jessedusty commented Jul 10, 2019

Fix race condition in the Java relay implementation due to timeout from no activity, it misses the cleaning deadline by a small number of milliseconds, and throws an exception because there are no open selectors.

Fixes #154

Evidence/log:
Used an additional print statement printing out the relevant variables and changed the original exception to a print

Selected keys size 1 now: 1562790544556 nextCleaningDeadline 1562790662669
Selected keys size 0 now: 1562790662667 nextCleaningDeadline 1562790662669
selector.select() returned without any event, an invalid SelectionKey was probably been registered
Selected keys size 0 now: 1562790662670 nextCleaningDeadline 1562790662669
Selected keys size 0 now: 1562790722672 nextCleaningDeadline 1562790722670

The print statement used was

System.out.println("Selected keys size " + selectedKeys.size() + " now: " + now + " nextCleaningDeadline " + nextCleaningDeadline);

Add this before line 56 of Genymoble:master Relay.java if you want to recreate it

Environment - java relay running on macOS 10.14

…e cleaning deadline by a small number of milliseconds

Fixes Genymobile#154

Evidence:

Selected keys size 1 now: 1562790544556 nextCleaningDeadline 1562790662669
Selected keys size 0 now: 1562790662667 nextCleaningDeadline 1562790662669
selector.select() returned without any event, an invalid SelectionKey was probably been registered
Selected keys size 0 now: 1562790662670 nextCleaningDeadline 1562790662669
Selected keys size 0 now: 1562790722672 nextCleaningDeadline 1562790722670
2019-07-10 16:32:02.673 I UDPConnection: UDP 10.0.0.2:31650 -> 208.67.222.222:53 Close
@rom1v
Copy link
Collaborator

rom1v commented Jul 10, 2019

Thank you for your PR.

I need to dive back into the code and think about it (but I have other things to do before, so it might take some time).

rom1v added a commit that referenced this pull request Sep 7, 2019
Fix #154 - relay dies with AssertionError
@rom1v
Copy link
Collaborator

rom1v commented Sep 7, 2019

Thank you very much, and sorry for the delay.

I finally found few hours tonight to work on gnirehtet. I rebased your commit onto current master and merged it as c814bfb.

@rom1v rom1v closed this Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

relay dies with AssertionError
2 participants