Rsync through java program - issues with remote connection failure

Hi Everybody,

I am running rsync through my java application.

The Java application will sync the files with remote machine. During our connection failure testing we noticed an issue running rsync through java program. The java application which is running at source side is not receiving any error message if there are any connection issues during the sync process.

Brief details about the test scenario:

  1. We run the Java Program
  2. The java program starts the rsync command and sync the large number of files from source to remote destination
  3. During the sync process we run the ps -ef | grep rsync to check whether the processes are running or not at both(source and dest) side. Both side rsync processes are running.
  4. We identify the rsync process id at target machine and kill the process with Kill -9 <pid>
  5. The java code didn't receive any error message and didn't exit. It just hanged.
  6. And also noticed that the rsync process is still running at source side and rsync process is also not printing any log message in the log file.

Note : If we run the rsync command directly (not through java program) , then everything is working fine. When we stop the rsync process at target the source process will be stopped.

Through perl its working fine. Not sure what the problem with java...!!!

I don't have any clues to debug this issue.
Please share your thoughts and pointer to debug.

execuse me if i confused you .

Thanks !!

Are you logging the error output of the java application? it may have thrown an exception which wasn't caught or got caught by something which didn't handle it properly.

Yes, I am handling exceptions and logging the error message. When RSYNC terminated at target, the Java program and RSYNC is not detecting that the target has issues. No log files written , Java program will hang and becomes unresponsive.