P
pvbemmel-at-xs4all-nl
Subject:
java calling rsync calling ssh: io threads blocked.
I'm trying to run a java program, that starts rsync, that uses ssh to
send data (--rsh option).
When I run the java program, all my I/O threads are waiting; nothing
happens, and rsync timeouts after 300 seconds.
In Eclipse in Debug mode, I see that all my threads are "Running" .
After I suspend each thread, I can see in what line of my code the
thread is executing:
Thread stdoutRunnable:
line 187: int num = procStdout.read(buf);
Thread stderrRunnable:
line 166: int num = procStderr.read(buf);
Thread stdinRunnable:
line 114: stdinLock.wait();
These are all statements that block.
When I run the same rsync command from a cygwin command shell, the rsync
runs okay.
The rsync.exe and ssh.exe are part of a Cygwin environment installed on
my machine.
(Respectively
rsync version 3.0.7 protocol version 30
and
OpenSSH_5.6p1, OpenSSL 0.9.8o 01 Jun 2010
)
The rsync command is:
C:/cygwin/bin/rsync \
--modify-window=2 \
--verbose \
--recursive \
--no-perms \
--no-group \
--times \
--fuzzy \
--compress \
--log-file="/cygdrive/c/Users/p.vanbemmelen/Documents/rsync/log/+logFile+" \
--rsync-path=rsync \
--stats \
--bwlimit="50" \
--progress \
--rsh="ssh -l p.vanbemmelen -i
/cygdrive/c/Users/p.vanbemmelen/.ssh/sshkey.ssh" \
--backup \
--human-readable \
--partial \
--timeout=300 \
--partial-dir=".rsync/partial/" \
--filter="exclude_p.vanbemmelen/downloads/" \
--chmod=u+rwx \
/cygdrive/c/cygwin/home/p.vanbemmelen \
(e-mail address removed):rbm/manualbackup \
(This command is hardcoded in the Java code; I can change a boolean in
that java code, and recompile, to print the command to stdout; so that
the same command can be issued from the cygwin command shell .)
I use ProcessBuilder from the Java library, and my own ProcessManager
class to listing to stdout, stderr of the rsync process.
I've attached the code.
The main() is in RsyncRunnableRemote.Test .
Note: The goal is to have a java program that can be installed on end
users' computers to give them an easy interface to rsync.
I'm perfectly able to run rsync on my own pc from the cygwin command
shell, but I really need to be able to run rsync from java.
Any help is appreciated,
Paul van Bemmelen.
java calling rsync calling ssh: io threads blocked.
I'm trying to run a java program, that starts rsync, that uses ssh to
send data (--rsh option).
When I run the java program, all my I/O threads are waiting; nothing
happens, and rsync timeouts after 300 seconds.
In Eclipse in Debug mode, I see that all my threads are "Running" .
After I suspend each thread, I can see in what line of my code the
thread is executing:
Thread stdoutRunnable:
line 187: int num = procStdout.read(buf);
Thread stderrRunnable:
line 166: int num = procStderr.read(buf);
Thread stdinRunnable:
line 114: stdinLock.wait();
These are all statements that block.
When I run the same rsync command from a cygwin command shell, the rsync
runs okay.
The rsync.exe and ssh.exe are part of a Cygwin environment installed on
my machine.
(Respectively
rsync version 3.0.7 protocol version 30
and
OpenSSH_5.6p1, OpenSSL 0.9.8o 01 Jun 2010
)
The rsync command is:
C:/cygwin/bin/rsync \
--modify-window=2 \
--verbose \
--recursive \
--no-perms \
--no-group \
--times \
--fuzzy \
--compress \
--log-file="/cygdrive/c/Users/p.vanbemmelen/Documents/rsync/log/+logFile+" \
--rsync-path=rsync \
--stats \
--bwlimit="50" \
--progress \
--rsh="ssh -l p.vanbemmelen -i
/cygdrive/c/Users/p.vanbemmelen/.ssh/sshkey.ssh" \
--backup \
--human-readable \
--partial \
--timeout=300 \
--partial-dir=".rsync/partial/" \
--filter="exclude_p.vanbemmelen/downloads/" \
--chmod=u+rwx \
/cygdrive/c/cygwin/home/p.vanbemmelen \
(e-mail address removed):rbm/manualbackup \
(This command is hardcoded in the Java code; I can change a boolean in
that java code, and recompile, to print the command to stdout; so that
the same command can be issued from the cygwin command shell .)
I use ProcessBuilder from the Java library, and my own ProcessManager
class to listing to stdout, stderr of the rsync process.
I've attached the code.
The main() is in RsyncRunnableRemote.Test .
Note: The goal is to have a java program that can be installed on end
users' computers to give them an easy interface to rsync.
I'm perfectly able to run rsync on my own pc from the cygwin command
shell, but I really need to be able to run rsync from java.
Any help is appreciated,
Paul van Bemmelen.