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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

In java, Relay starts but nothing happens #369

Closed
jurandy007 opened this issue Mar 8, 2021 · 10 comments
Closed

In java, Relay starts but nothing happens #369

jurandy007 opened this issue Mar 8, 2021 · 10 comments
Labels

Comments

@jurandy007
Copy link

In java Relay starts but nothing happens.
I have installed on my windows 10 the JRE 8 281 x86 and x64. This only happens with gnirehtet java.

馃憞

PS C:\Android\Gnirehtet\Java> .\gnirehtet-run.cmd
2021-03-08 19:54:24.855 I Gnirehtet: Starting relay server on port 31416...
2021-03-08 19:54:24.855 I Gnirehtet: Checking gnirehtet client...
2021-03-08 19:54:25.015 I Relay: Relay server started

@rom1v
Copy link
Collaborator

rom1v commented Mar 8, 2021

Your device should open a popup. Some devices system have bugs with the popup if the screen is off (or in other conditions), gnirehtet just request the system to open a VPN.

@rom1v
Copy link
Collaborator

rom1v commented Mar 8, 2021

This only happens with gnirehtet java.

You mean, with the Rust version, it works?

@jurandy007
Copy link
Author

yes, in the rust version it works

@jurandy007 jurandy007 changed the title In java Relay starts but nothing happens In java, Relay starts but nothing happens Mar 9, 2021
@rom1v
Copy link
Collaborator

rom1v commented Mar 9, 2021

Sorry, I could not reproduce. On Windows, if I run gnirehtet-run.cmd, it works as expected.

It is very suspicious that the Rust version works but the Java version fails to "start", since they execute exactly the same command.

@mythsman
Copy link

Sorry, I could not reproduce. On Windows, if I run gnirehtet-run.cmd, it works as expected.

It is very suspicious that the Rust version works but the Java version fails to "start", since they execute exactly the same command.

I encouter this problem too .

The progress stucks at process.waitFor() , because its output buffer is full ,so it is waiting for its output to be read by another progress . However the scanner cannot read the output because process.waitFor() is a blocking method.

This problem only occurs when the output of the progress is larger than the default write buffer... so it works well usually..

The solution is that we can redirect the output to another file, and then read from that file...

#370

@rom1v
Copy link
Collaborator

rom1v commented Mar 11, 2021

The progress stucks at process.waitFor(), because its output buffer is full

Oh, yes! 馃憤

The solution is that we can redirect the output to another file, and then read from that file...

Instead we could parse the output stream before waitFor().

@mythsman
Copy link

The progress stucks at process.waitFor(), because its output buffer is full

Oh, yes! 馃憤

The solution is that we can redirect the output to another file, and then read from that file...

Instead we could parse the output stream before waitFor().

Yes, but I think it is not the best practice. If the output is slow , you may read a fake 'eof' before the progress is actually finished :)

@rom1v
Copy link
Collaborator

rom1v commented Mar 11, 2021

If the output is slow , you may read a fake 'eof' before the progress is actually finished

Hmm, no, you may not read a fake EOF. You may get partial reads, but not fake EOF.

Writing a file to the filesystem for that is not necessary.

@mythsman
Copy link

If the output is slow , you may read a fake 'eof' before the progress is actually finished

Hmm, no, you may not read a fake EOF. You may get partial reads, but not fake EOF.

Writing a file to the filesystem for that is not necessary.

Well , I just cannot come up with another solution to avoid partial reads except for creating another thread to read it ...

@rom1v rom1v added the bug label Mar 11, 2021
rom1v added a commit that referenced this issue Mar 14, 2021
The process may stuck because its output buffer is full, but the output
was consumed only after the process was terminated, causing a deadlock.

Consume process output before waiting for process termination to fix the
problem.

Refs #369 <#369>
Refs #370 <#370>

Co-authored-by: tusenpo <tusenpo@pinduoduo.com>
@rom1v
Copy link
Collaborator

rom1v commented Mar 14, 2021

Fixed on dev. See #370 (comment)

@rom1v rom1v closed this as completed Mar 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants