While running a Job on a remote JobServer from Studio, the connection fails with an error similar to the following:
[statistics] connecting to socket on port XXXX
[statistics] connection refused
Unable to connect to "IP address" on the port XXXX
In this case, the IP address and Statistics port are both used by Studio.
Root Cause
Assuming that the Studio IP address is accessible from the JobServer machine (you can do a ping or telnet to check); the error means that the JobServer is not able to access the Statistics port, either because the chosen port is not open or there is another security/firewall restriction from JobServer machine.
Solution
Ensure that the port selected by Studio (as it is a dynamic port) is open from your JobServer machine. You can check the range of the ports that need to be open in Studio, by navigating to Window > Preferences > Talend > Run/Debug > Stats port range.
Workaround
If you don't require Statistics, disable it on the Job's Run>Advanced settings tab, to avoid this error.