ServerSync

ServerSync

48.5k Downloads

Automation problem

HaibaraGT opened this issue · 4 comments

commented

Serversync Version:

4.1.0

Minecraft Version:

1.12.2

Issue:

The [--progress only] command is invalid after version 3.7.0-al6.
After version 4.0, the launcher can no longer use the above command to automate the synchronization.

commented

I found the reason why:
ServerSync is using java build-in logger lib, when using no-window mode, it may ran into the problem like there: https://stackoverflow.com/questions/634102/log4j-is-hanging-my-application-what-am-i-doing-wrong

It will fill the write buffers of ConsoleHandler which will be added as parent logger by default , and making endless waiting there.

Thread Dumps from debugger proved this:

"pool-1-thread-4@1698" prio=5 tid=0x12 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at java.io.FileOutputStream.writeBytes(FileOutputStream.java:-1)
	  at java.io.FileOutputStream.write(FileOutputStream.java:326)
	  at java.io.BufferedOutputStream.write(BufferedOutputStream.java:122)
	  - locked <0x6ab> (a java.io.BufferedOutputStream)
	  at java.io.PrintStream.write(PrintStream.java:480)
	  - locked <0x6ac> (a java.io.PrintStream)
	  at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221)
	  at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291)
	  at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295)
	  at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141)
	  - locked <0x6ad> (a java.io.OutputStreamWriter)
	  at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229)
	  at java.util.logging.StreamHandler.flush(StreamHandler.java:259)
	  - locked <0x6ae> (a java.util.logging.ConsoleHandler)
	  at java.util.logging.ConsoleHandler.publish(ConsoleHandler.java:117)
	  at java.util.logging.Logger.log(Logger.java:738)
	  at java.util.logging.Logger.doLog(Logger.java:765)
	  at java.util.logging.Logger.log(Logger.java:788)
	  at java.util.logging.Logger.info(Logger.java:1490)
	  at com.superzanti.serversync.util.LoggerInstance.log(LoggerInstance.java:60)
	  - locked <0x6af> (a com.superzanti.serversync.util.LoggerInstance)
	  at com.superzanti.serversync.util.Logger.log(Logger.java:45)
	  - locked <0x13a> (a java.lang.Class)
	  at com.superzanti.serversync.client.ClientWorker.lambda$executeActions$1(ClientWorker.java:51)
	  at com.superzanti.serversync.client.ClientWorker$$Lambda$33.1376063218.call(Unknown Source:-1)
	  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	  at java.lang.Thread.run(Thread.java:748)

According to javadoc, this handler will write to System.err, so just redirect System.err or replace/disable parent logger will fix it.

commented

There is still a problem, I successfully started ss with the -o command. But the GUI cannot be displayed.
I experimented with MultiMC and HMCL launchers.
Here both launchers can use the java -jar ss.jar -o command to start serversync, the gui cannot be displayed, the log file shows that the server has been successfully connected, and a serious error occurred when writing the file.

HMCL:
serversync-CLIENT.log
MultiMC:
serversync-client.log

commented

The startup process of minecraft will be suspended and will not resume for a long time unless the SS program is manually stopped.

commented

The old flag for progress only does not use -- syntax.

The progress only command works with either the original form or the new standard flags.
-o
--progress
progress-only

https://github.com/superzanti/ServerSync/wiki/Command-line-arguments

I removed the progress-only flag from the documentation as it is not really what I want to support moving forward.