Infinite loop
Lurgrid opened this issue · comments
I'm running a Fedora 40 (Sway) 64bit and I've noticed that the viaproxy launch loops indefinitely. After reading your code and launching the .jar by hand, I noticed that in my case the parameters are wrong
$ java -jar ViaProxy-3.2.1.jar --bind_port 25568 --version 1.12.2 --openauthmod_auth --target_ip 127.0.0.1 --target_port 0
[02:54:23] [main/INFO] (ViaProxy) Initializing ViaProxy CLI v3.2.1 (git-ViaProxy-3.2.1:6a48668) (Injected using Launcher Agent)...
[02:54:23] [main/INFO] (ViaProxy) Using java version: OpenJDK 64-Bit Server VM 21.0.3 (Red Hat, Inc.) on Linux
[02:54:23] [main/INFO] (ViaProxy) Available memory (bytes): 4118806528
[02:54:23] [main/INFO] (ViaProxy) Working directory: /home/culottes/Downloads
[02:54:23] [Via-Mappingloader-0/INFO] (ViaVersion) Loading block connection mappings ...
[02:54:23] [main/INFO] (ViaBackwards) Loading translations...
[02:54:23] [main/INFO] (ViaBackwards) Registering protocols...
[02:54:23] [main/INFO] (ViaRewind) Registering protocols...
[02:54:24] [main/INFO] (ViaBedrock) Started resource pack HTTP server on http://127.0.0.1:45085/
[02:54:24] [main/INFO] (ViaVersion) ViaVersion detected lowest supported version by the proxy: 1.7.2-1.7.5 (4)
[02:54:24] [main/INFO] (ViaVersion) Highest supported version by the proxy: 1.20.5-1.20.6 (766)
[02:54:24] [main/FATAL] (ViaProxy) ===============================================================================================================
[02:54:24] [main/FATAL] (ViaProxy) You are using the old ViaProxy CLI which is deprecated and will be removed in the next version of ViaProxy. Please use the new CLI or config file instead. See the ViaProxy README on GitHub for more information.
[02:54:24] [main/FATAL] (ViaProxy) Waiting 10 seconds before continuing...
[02:54:24] [main/FATAL] (ViaProxy) ===============================================================================================================
[02:54:27] [Via Async Scheduler 0/INFO] (ViaVersion) Finished mapping loading, shutting down loader executor!
[02:54:34] [main/ERROR] (ViaProxy) Error parsing options: bind_port is not a recognized option
Option (* = required) Description
--------------------- -----------
-?, -h, --help Get a list of all arguments
* -a, --ca, --connect_address, -- The address of the target server
target_ip <String>
--allow-beta-pinging Enabling this will allow you to ping
<= b1.7.3 servers. This may cause
issues with servers that block too
frequent connections
--ba, --bind_address, --bind_ip The address the proxy should bind to
<String> (default: 0.0.0.0:25568)
--betacraft_auth Use BetaCraft authentication for
classic servers
-c, --compression_threshold, --ct The threshold for packet compression
<Integer> (default: 256)
--gui_account, --gui_account_index Use an account from the ViaProxy GUI
<Integer> for joining online mode servers
(Specify -1 for instructions)
--ignore-packet-translation-errors Enabling this will prevent getting
disconnected from the server when a
packet translation error occurs and
instead only print the error in the
console. This may cause issues
depending on the type of packet
which failed to translate
--internal_srv_mode, --isrv Enable internal srv mode
--legacy_client_passthrough, -- Allow <= 1.6.4 clients to connect to
legacy_passthrough the backend server (No protocol
translation)
-o, --om, --online_mode Enable proxy online mode
--oam_auth, --openauthmod_auth Use OpenAuthMod for joining online
mode servers
--proxy, --proxy_url <String> URL of a SOCKS(4/5)/HTTP(S) proxy
which will be used for backend TCP
connections
--resource_pack, --resource_pack_url, URL of a resource pack which clients
--rp, --rpu <String> can optionally download
-s, --srv, --srv_mode Enable srv mode
--server-haproxy, --server-haproxy- Send HAProxy protocol messages to the
protocol backend server
* -v, --version <c0.0.15a-1, c0.0.16a- The version of the target server
02, c0.0.18a-02, c0.0.19a-06, c0.0.20
a-c0.27, c0.28-c0.30, c0.30 CPE, a1.
0.15, a1.0.16-a1.0.16.2, a1.0.17-a1.
0.17.4, a1.1.0-a1.1.2.1, a1.2.0-a1.
2.1.1, a1.2.2, a1.2.3-a1.2.3.4, a1.
2.3.5-a1.2.6, b1.0-b1.1.1, b1.1.2,
b1.2-b1.2.2, b1.3-b1.3.1, b1.4-b1.
4.1, b1.5-b1.5.2, b1.6-b1.6.6, b1.7-
b1.7.3, b1.8-b1.8.1, 1.0.0-1.0.1,
1.1, 1.2.1-1.2.3, 1.2.4-1.2.5, 1.3.1-
1.3.2, 1.4.2, 1.4.4-1.4.5, 1.4.6-
1.4.7, 1.5-1.5.1, 1.5.2, 1.6.1,
1.6.2, 1.6.4, 1.7.2-1.7.5, 1.7.6-
1.7.10, 1.8.x, 1.9, 1.9.1, 1.9.2,
1.9.3-1.9.4, 1.10.x, 1.11, 1.11.1-
1.11.2, 1.12, 1.12.1, 1.12.2, 1.13,
1.13.1, 1.13.2, 3D Shareware, 1.14,
1.14.1, 1.14.2, 1.14.3, 1.14.4,
1.15, 1.15.1, 1.15.2, 20w14infinite,
1.16, 1.16.1, Combat Test 8c,
1.16.2, 1.16.3, 1.16.4-1.16.5, 1.17,
1.17.1, 1.18-1.18.1, 1.18.2, 1.19,
1.19.1-1.19.2, 1.19.3, 1.19.4, 1.20-
1.20.1, 1.20.2, 1.20.3-1.20.4,
Bedrock 1.20.70, 1.20.5-1.20.6, Auto
Detect (1.7+ servers)>
As indicated, the bind_port
option does not exist, but by playing with the parameters I found that this command worked java -jar ViaProxy-3.2.1.jar --bind_ip 127.0.0.1:25568 --version 1.12.2 --openauthmod_auth --target_ip 127.0.0.1
As a result, this loop, line 112, loops indefinitely because it can never read Binding proxy server to
.
loop {
line.clear();
stdout.read_line(&mut line).await.unwrap();
if line.contains("Binding proxy server to ") {
info!("ViaProxy is ready!");
break;
}
}
So I corrected the jar launch
let mut child = tokio::process::Command::new("java")
.current_dir(&download_directory)
.arg("-jar")
.arg(download_path)
.arg("--bind_ip")
.arg(format!("127.0.0.1:{}", bind_port))
.arg("--internal_srv_mode")
.arg("--version")
.arg(version)
.arg("--openauthmod_auth")
// target_ip and target port don't matter since we're using internal_srv_mode
.arg("--target_ip")
.arg("127.0.0.1")
.stdout(std::process::Stdio::piped())
.spawn()
.expect("Failed to start ViaProxy");
Unfortunately it doesn't work completely, I manage to leave the infinite loop but when I connect I get an error. But I don't know if it's my fault
2024-05-12T01:03:54.962507Z INFO azalea_viaversion: ViaProxy is ready!
2024-05-12T01:03:55.400074Z ERROR azalea::swarm: Error joining as SAGB0T: Disconnected: Automatic protocol detection failed!
java.lang.RuntimeException: Unhandled exception during ping. Waiting 10s and trying again.
Thanks for reading and I hope I've helped!
I might have the same issue (Fedora 40 KDE Spin). It's just not doing anything beyond downloading ViaProxy the first time. No debug logs either.