Getting java.net.SocketException: Connection reset

java

#1

I am building a java project with java 8 using maven. Locally with maven and through intellij,and on production servers, all of my tests are passing. When I build on circle I am getting:

java.net.SocketException: Connection reset
	at java.net.SocketInputStream.read(SocketInputStream.java:209)
	at java.net.SocketInputStream.read(SocketInputStream.java:141)
	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
	at java.io.InputStreamReader.read(InputStreamReader.java:184)
	at java.io.BufferedReader.fill(BufferedReader.java:161)
	at java.io.BufferedReader.readLine(BufferedReader.java:324)
	at java.io.BufferedReader.readLine(BufferedReader.java:389)
	at com.xjeffrose.xio.fixtures.TcpClient.sendReq(TcpClient.java:20)

The code in question is very a very simple test fixture that looks like this:

   try {
      ServerSocket socket = new ServerSocket(port);
      Socket connectionSocket = socket.accept();

      BufferedReader inFromClient = new BufferedReader(new InputStreamReader(connectionSocket.getInputStream()));
      PrintWriter out = new PrintWriter(connectionSocket.getOutputStream(), true);
      String req = inFromClient.readLine();
      System.out.println("RECIEED REQ: " + req);
      out.println(req);

      connectionSocket.close();
      socket.close();
    } catch (IOException e) {
      e.printStackTrace();
    }

I am at a loss tryign to track down and fix this issue.

Link to an example build:

https://circleci.com/gh/xjdr/xio/32


#3

Sorry for the long delay, are you still having this issue?


#4

just had the exact same error on the play framework API tests. They use akka actors systems and thus java sockets to connect to the app endpoints. It happens randomly and does not depend on the tests.


Here is the trace, can you please advise?
Thanks!


#5

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.