Java socket reset error

#1

Some issues with java/scala Play test suite using java.net.SocketInputStream under the hood.
When testing api responses, there seem to be some socket reset issue making the tests fail.
Does happen randomly from time to time but for sure in a 10 mn long test

[info] - should return a fetchable BatteryLevel
[info] play - Starting application default Akka system.
[info] play - Shutdown application default Akka system.
[info] - should return an error when the device does not exist
Exception in thread "Thread-1" Exception in thread "Thread-5" java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(SocketInputStream.java:210)
at java.net.SocketInputStream.read(SocketInputStream.java:141)
at java.net.SocketInputStream.read(SocketInputStream.java:224)
at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2639)
at java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2946)
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2956)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1538)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at sbt.React.react(ForkTests.scala:117)
at sbt.ForkTests$$anonfun$mainTestTask$1$Acceptor$2$.run(ForkTests.scala:76)
at java.lang.Thread.run(Thread.java:748)
java.io.EOFException
at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2958)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1538)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1$React.react(Framework.scala:945)
at org.scalatest.tools.Framework$ScalaTestRunner$Skeleton$1.run(Framework.scala:934)
at java.lang.Thread.run(Thread.java:748)```
#3

Yes indeed, I did it.

1 Like
#4

I wonder if this crash is happening at the start of your tests immediately after your socket is opened. If so, I’d consider sleeping for a second or two to wait for the listener to stabilise.

#5

there is a 1 before the picture, the paste is wrong, I meant that this problem does occur very often for tests that last longer than 5 to 10 mn

1 Like
#7

any update on this issue regarding the java circle ci server configuration? Circle Team?

#8

It’s difficult to know what is happening here. I wonder if this could be a code/OS problem, and so asking CircleCI for assistance may not be the right approach, unless you can show it is a bug.

This dilemma is rather akin to folks obtaining web space from a host and asking the hosting company for assistance debugging WordPress - it isn’t scalable to ask the hosting/CI company to get involved with this sort of thing. I am not saying you don’t have a CI bug - just wondering if this is part of the usual pains of implementing CI, and that getting external assistance might be a good idea.

One practical thing you could do is to try to Dockerise these tests, assuming you are not relying on any system-level stuff. If you can do that you could get them to run locally, and then transferring them to CI is much less of a hassle, using Docker-in-Docker.

closed #9

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