rolandschulz / PTP

Eclipse Parallel Tools Platform
http://www.eclipse.org/ptp/
6 stars 3 forks source link

Make Remote Execution Robust #13

Closed eblen closed 13 years ago

eblen commented 13 years ago

Currently, executing of remote commands is done inside the class rdt.sync.git.core.CommandRunner. This command runner is not robust and can cause deadlock if buffers should overflow.

rolandschulz commented 13 years ago

The implementation you commited isn't thread safe. The call to getIOException and getResult can happen before the data is written to those member variables within the run method.

It is not good practice to use streamReader.readLine for reading unless you really need lines.

Also one shoudn't use String to buffer. Instead one should use e.g. ByteArrayOutputStream

Instead of rewriting it you could use org.eclipse.jgit.util.io.StreamCopyThread. At least you need a similar halt method and I think the design of passign both streams in the constructor is better.

If you want I can provide a suggested implementation.

eblen commented 13 years ago

Okay, I modified the command runner to use StreamCopyThread. If you think it looks good, I'll close the issue.