java.net.SocketTimeoutException: Read timed out exception while reading from dumper

988 views
Skip to first unread message

Veenavani Revanuru

unread,
Jan 6, 2018, 2:22:58 PM1/6/18
to JaCoCo and EclEmma Users
Hi,
I am getting the foll. exception when I try to get the dump on a port connecting to the server where the jacoco agent is running
My goal is to capture the test coverage after evety test is run, henc I  am calling the jacoco dumper 
I have the jacoco  agent  running with below params:
set the foll in weblogic appserver

JAVA_OPTIONS="${JAVA_OPTIONS} -

javaagent:/podscratch/jacoco/jacocoagent.jar=output=tcpserver,address=xxxxx,port

=6015,append=false,dumponexit=false,classdumpdir=/podscratch/classdumpdir,destfile=/podscratch/co

verage/coverage.exec"

Exception:
--------------------------------------
I get the below exception while it reads from the dumper:
Exception in thread "main" java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.socketRead(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.net.SocketInputStream.read(Unknown Source)
        at java.io.DataInputStream.readByte(Unknown Source)
        at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.jav
a:82)
        at JacocoDumper.main(JacocoDumper.java:58)

My dumper code is something like this:
ublic class JacocoDumper{
private static final String DESTFILE = "jacoco-client.exec";

private static final String ADDRESS = "slc09rjj.us.oracle.com";

private static final int PORT = 6015;


public static void main(String args[]) throws Exception{

//command to run the test
String[] out1 = runCommand("java -jar REEATSGenericCLI.jar -action=execute -test_set_path="Test1" );
        String jobId = null;
System.out.println((jobId= out1[0].split("job id=\"")[1].split("\"")[0]));
String[] out2 = null;
for(;;){
Thread.sleep(1000);
out2 = runCommand("java -jar ALM\\REEATSGenericCLI.jar -action=status  -job_id=\""+jobId+"\"");
if(!out2[1].contains("Given job not found."))
break;
}
}
System.out.println(out2[0]);
final FileOutputStream localFile = new FileOutputStream(DESTFILE);
final ExecutionDataWriter localWriter = new ExecutionDataWriter(
localFile);

// Open a socket to the coverage agent:
final Socket socket = new Socket(InetAddress.getByName(ADDRESS), PORT);
final RemoteControlWriter writer = new RemoteControlWriter(
socket.getOutputStream());
final RemoteControlReader reader = new RemoteControlReader(
socket.getInputStream());
reader.setSessionInfoVisitor(localWriter);
reader.setExecutionDataVisitor(localWriter);

// Send a dump command and read the response:
System.out.println("before dump ");
writer.visitDumpCommand(true, true);
System.out.println("after dump  read");
if (!reader.read()) {
throw new IOException("Socket closed unexpectedly.");
}

socket.close();
localFile.close();
}

Any idea on waht the issue?
thanks

ari

unread,
Jan 6, 2018, 2:55:50 PM1/6/18
to JaCoCo and EclEmma Users
Even the jacococli throws the similar error:
>>java -jar jacococli.jar dump --destfile jacoco.exec --address xxxx   --port 6015
[INFO] Connecting to xxxxx/10.240.92.25:6015.
Exception in thread "main" java.net.SocketException: Connection reset
        at java.net.SocketInputStream.read(SocketInputStream.java:197)
        at java.net.SocketInputStream.read(SocketInputStream.java:122)
        at java.net.SocketInputStream.read(SocketInputStream.java:211)
        at java.io.FilterInputStream.read(FilterInputStream.java:83)
        at org.jacoco.cli.internal.core.data.ExecutionDataReader.read(ExecutionDataReader.java:83)
        at org.jacoco.cli.internal.core.tools.ExecDumpClient.dump(ExecDumpClient.java:127)
        at org.jacoco.cli.internal.core.tools.ExecDumpClient.dump(ExecDumpClient.java:98)
        at org.jacoco.cli.internal.commands.Dump.execute(Dump.java:69)
        at org.jacoco.cli.internal.Main.execute(Main.java:89)
        at org.jacoco.cli.internal.Main.main(Main.java:104)




thanks

private static final String ADDRESS = "xxxx"

Marc Hoffmann

unread,
Jan 8, 2018, 4:53:57 AM1/8/18
to jac...@googlegroups.com

Hi,

hard to tell what the issue are. It looks like the target prozess is not properly running or has been killed during the dump (connection reset).

Note that output=tcpserver only works for long running processes. The process with the attached JaCoCo agent needs to be up and running for the entire time while executing the dump command.

Another possible reason might be firewall or routing issues.

Regards,
-marc

--
You received this message because you are subscribed to the Google Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jacoco+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jacoco/0db873cc-ee94-43b4-91f1-83ef318b04cd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

ari

unread,
Jan 15, 2018, 9:20:02 PM1/15/18
to JaCoCo and EclEmma Users
I am using the latest jacoco(0.8.0) and now see this error, dails while it reads the dump from the execution Data Reader.

before dump
after dump  read

Exception in thread "main" java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at java.net.SocketInputStream.read(SocketInputStream.java:182)
        at java.io.FilterInputStream.read(FilterInputStream.java:66)
        at org.jacoco.core.data.ExecutionDataReader.read(ExecutionDataReader.jav
a:83)
        at REETest.main(REETest.java:49)

any pointers?
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages