superzanti / ServerSync

Sync files between client and server for Minecraft Forge
GNU General Public License v3.0
160 stars 26 forks source link

.jar issues, unable to find mod folder, client sets Path to WINDOWS/system32 #270

Closed ZuckerSchock closed 3 years ago

ZuckerSchock commented 3 years ago

Serversync Version: 4.1.0

Minecraft Version: 1.16.5

Issue:

UPDATE: The issues only happen, when starting the .jar as client, when using the .exe or using automated script this doesn't happen. Could have something to do with java version.

Backups arent possible because: [Mai 30, 2021 2:09:33][ServerSync] INFORMATION: Starting the zip "mods" folder [Mai 30, 2021 2:09:33][ServerSync] INFORMATION: Folder "mods" not found [Mai 30, 2021 2:09:33][ServerSync] INFORMATION: Starting the zip "config" folder

Client is able to receive the file list from the server but is unable to update them. In the Sync area action is: "Update" Reason: "File does not exist"

Log: copied the part i believe to be important to here under Logs tab

SCHWERWIEGEND is German for critical/severe

Logs (serverysync & minecraft)

CLIENT:

[Mai 30, 2021 12:59:47][ServerSync] INFORMATION: Updating file ActionEntry{path='C:\WINDOWS\system32\mods\chiselsandbits-0.2.9-RELEASE.jar',reason='ui/reason_does_not_exist'

[Mai 30, 2021 12:59:47][ServerSync] SCHWERWIEGEND: Failed to create parent directories for: C:\WINDOWS\system32\mods\chiselsandbits-0.2.9-RELEASE.jar

[Mai 30, 2021 12:59:47][ServerSync] FEIN: [sun.nio.fs.WindowsException.translateToIOException(Unknown Source), sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source), sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source), sun.nio.fs.WindowsFileSystemProvider.createDirectory(Unknown Source), java.nio.file.Files.createDirectory(Unknown Source), java.nio.file.Files.createAndCheckIsDirectory(Unknown Source), java.nio.file.Files.createDirectories(Unknown Source), com.superzanti.serversync.communication.SyncFileOutputStream.write(SyncFileOutputStream.java:29), com.superzanti.serversync.communication.Requests.updateFile(Requests.java:132), com.superzanti.serversync.client.ManifestServer.updateIndividualFile(ManifestServer.java:20), com.superzanti.serversync.client.Mode2Sync.executeActionList(Mode2Sync.java:37), com.superzanti.serversync.client.ClientWorker.lambda$executeActions$1(ClientWorker.java:52), java.util.concurrent.FutureTask.run(Unknown Source), java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source), java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source), java.lang.Thread.run(Unknown Source)]

[Mai 30, 2021 12:59:47][ServerSync] SCHWERWIEGEND: Failed to create new file for: C:\WINDOWS\system32\mods\chiselsandbits-0.2.9-RELEASE.jar

SERVER:

SERVER:

[Mai 30, 2021 12:55:51][ServerSync] INFORMATION: Writing C:\Server\Zusammen Create Server\Zusammen\Server Aktuell\mods\chiselsandbits-0.2.9-RELEASE.jar to client /XXXXX...
[Mai 30, 2021 12:55:51][ServerSync] FEIN: File size is: 846269
[Mai 30, 2021 12:55:51][ServerSync] FEIN: Failed to write file: C:\Server\Zusammen Create Server\Zusammen\Server Aktuell\mods\chiselsandbits-0.2.9-RELEASE.jar
[Mai 30, 2021 12:55:51][ServerSync] FEIN: [java.net.SocketOutputStream.socketWrite0(Native Method), java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111), java.net.SocketOutputStream.write(SocketOutputStream.java:155), com.superzanti.serversync.server.ServerWorker.transferFile(ServerWorker.java:300), com.superzanti.serversync.server.ServerWorker.run(ServerWorker.java:157), java.lang.Thread.run(Thread.java:748)]
[Mai 30, 2021 12:55:51][ServerSync] INFORMATION: Finished writing: C:\Server\Zusammen Create Server\Zusammen\Server Aktuell\mods\chiselsandbits-0.2.9-RELEASE.jar, to client: /XXXXX
[Mai 30, 2021 12:55:51][ServerSync] FEIN: Reset timeout for client: /XXXXXXX, with a timeout of: 120000
[Mai 30, 2021 12:55:51][ServerSync] INFORMATION: Closing connection with: Socket[addr=/XXXXXXX,port=XXXXXX,localport=XXXXXX]
[Mai 30, 2021 12:55:57][ServerSync] INFORMATION: Connection established with Socket[addr=/XXXXXX,port=XXXXXX,localport=XXXXXX]30.05.2021 12:55:57
[Mai 30, 2021 12:55:57][ServerSync] FEIN: Reset timeout for client: /XXXXXXX, with a timeout of: 120000
[Mai 30, 2021 12:55:57][ServerSync] INFORMATION: Received message: SERVER_INFO, from client: /XXXXXXXX
[Mai 30, 2021 12:55:57][ServerSync] INFORMATION: Sending server  information

rheimus commented 3 years ago

Seems like however your java is configured it is running jar files from the default shell location WIN/SYSTEM32 rather than PWD or current working directory.

It will be working from the exe and scripts as those will most likely have the working directory in the same location as SS.

This might be useful 🤷‍♂️, cant say I have ever had jar file association issues but I have seen a few cases of this happening. https://johann.loefflmann.net/en/software/jarfix/index.html

ZuckerSchock commented 3 years ago

Seems like however your java is configured it is running jar files from the default shell location WIN/SYSTEM32 rather than PWD or current working directory.

It will be working from the exe and scripts as those will most likely have the working directory in the same location as SS.

This might be useful 🤷‍♂️, cant say I have ever had jar file association issues but I have seen a few cases of this happening. https://johann.loefflmann.net/en/software/jarfix/index.html

Thanks for the reply, the issue does not only affect me, as i set everything up, i tried it out with one of my friends who wanted to use it. He had the exact same issue, WIN/SYSTEM32 as well.

Its not a big deal for me, since scripts are superior for our case anyway, but it could cause other users problems when setting everything up, like it did for me.

While you are correct, that both of us had different default program associations, we both started the .jar with java from the "open with" dialogue. I believe, the jar fix is mostly for wrongly associated programs with .jar, which would make it so that the interface wouldn't even start in the first place, what it did for us. Maybe you are right and this could fix part of it, but i have the JDK as the default program for .jar and i don't want to overwrite it.

ZuckerSchock commented 3 years ago

Maybe i can ask my friend to use it and see if it fixes it for him by any chance, guess he can use it anyway.

rheimus commented 3 years ago

The jarfix solves file association but it also tweaks some registry settings that change the way java is started when you use the right click menu or double click.

If you feel adventurous you could dig into the registry and see how your java is being started, it will be something like javaw.exe %1 %*

Computer\HKEY_CLASSES_ROOT\jarfile\shell\open\command Mine is this: "C:\Program Files\Java\jdk1.8.0_211\bin\javaw.exe" -jar "%1" %*, this is pointing to the JDK, though for normal users this will probably point at a JRE version instead.

It might be worthy of note that I have the JRE/JDK bin in my Path.

ZuckerSchock commented 3 years ago

The jarfix solves file association but it also tweaks some registry settings that change the way java is started when you use the right click menu or double click.

If you feel adventurous you could dig into the registry and see how your java is being started, it will be something like javaw.exe %1 %*

Computer\HKEY_CLASSES_ROOT\jarfile\shell\open\command Mine is this: "C:\Program Files\Java\jdk1.8.0_211\bin\javaw.exe" -jar "%1" %*, this is pointing to the JDK, though for normal users this will probably point at a JRE version instead.

It might be worthy of note that I have the JRE/JDK bin in my Path.

Mine is: "C:\Program Files\Java\jre1.8.0_291\bin\javaw.exe" -jar "%1" %*

rheimus commented 3 years ago

Interesting, it would seem that if you use 'Open With' and choose java then it loses the context of where you are running it from, while a double click run does not.

This make some amount of sense I suppose as open with java would probably just resolve to java <thing>.

ZuckerSchock commented 3 years ago

Oh sweet, so that is the cause of the issue, weird but makes kind of sense. Good job on finding it. I tested it as well, quickly switched the default file association on the windows "open with" dialogue back to the jre which i used in the first place. It worked like it should, backups and sync. Thanks, is there a way to flag the answer so that other people quickly have a fix ?

rheimus commented 3 years ago

I'll add some sort of troubleshooting section to the wiki for this project

ZuckerSchock commented 3 years ago

Nice, i just saw the section you added. Guess i can close the issue now. Thanks for your effort.