Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Testing] Fix rest QueryServiceTest #118

Open
dariagolub opened this issue Oct 31, 2017 · 1 comment
Open

[Testing] Fix rest QueryServiceTest #118

dariagolub opened this issue Oct 31, 2017 · 1 comment
Assignees

Comments

@dariagolub
Copy link
Contributor

Test failure is not always reproducing.

com.bagri.rest.service.QueryServiceTest#testQueryService

assertEquals(3, results.size()); - actual result sometimes is 0, because of I/O error:

org.glassfish.jersey.server.ServerRuntime$Responder writeResponse SEVERE: An I/O error has occurred while writing a response message entity chunk to the container output stream. org.eclipse.jetty.io.EofException: Closed at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:325) at org.glassfish.jersey.message.internal.CommittingOutputStream.write(CommittingOutputStream.java:229) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$UnCloseableOutputStream.write(WriterInterceptorExecutor.java:299) at sun.nio.cs.StreamEncoder.writeBytes(StreamEncoder.java:221) at sun.nio.cs.StreamEncoder.implFlushBuffer(StreamEncoder.java:291) at sun.nio.cs.StreamEncoder.implFlush(StreamEncoder.java:295) at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:141) at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:229) at org.glassfish.jersey.message.internal.ReaderWriter.writeToAsString(ReaderWriter.java:193) at org.glassfish.jersey.message.internal.AbstractMessageReaderWriterProvider.writeToAsString(AbstractMessageReaderWriterProvider.java:130) at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:99) at org.glassfish.jersey.message.internal.StringMessageProvider.writeTo(StringMessageProvider.java:59) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.invokeWriteTo(WriterInterceptorExecutor.java:265) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor$TerminalWriterInterceptor.aroundWriteTo(WriterInterceptorExecutor.java:250) at org.glassfish.jersey.message.internal.WriterInterceptorExecutor.proceed(WriterInterceptorExecutor.java:162) at org.glassfish.jersey.message.internal.MessageBodyFactory.writeTo(MessageBodyFactory.java:1130) at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:219) at org.glassfish.jersey.server.ChunkedOutput$1.call(ChunkedOutput.java:190) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:242) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:367) at org.glassfish.jersey.server.ChunkedOutput.flushQueue(ChunkedOutput.java:190) at org.glassfish.jersey.server.ChunkedOutput.setContext(ChunkedOutput.java:372) at org.glassfish.jersey.server.ServerRuntime$Responder.writeResponse(ServerRuntime.java:760) at org.glassfish.jersey.server.ServerRuntime$Responder.processResponse(ServerRuntime.java:444) at org.glassfish.jersey.server.ServerRuntime$Responder.process(ServerRuntime.java:434) at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:329) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) at org.glassfish.jersey.internal.Errors.process(Errors.java:315) at org.glassfish.jersey.internal.Errors.process(Errors.java:297) at org.glassfish.jersey.internal.Errors.process(Errors.java:267) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) at org.glassfish.jersey.jetty.JettyHttpContainer.handle(JettyHttpContainer.java:195) at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97) at org.eclipse.jetty.server.Server.handle(Server.java:499) at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311) at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257) at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544) at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635) at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555) at java.lang.Thread.run(Thread.java:745)

@dsukhoroslov
Copy link
Owner

dsukhoroslov commented Oct 31, 2017

Thanks Dasha, it helps! It looks like we have race conditions here and REST server has been stopped earlier than result was written to the output stream. Adding some delay in the test beforeClose method should help. Could you fix this one?

@dsukhoroslov dsukhoroslov added this to the Maintenance release 1.2 milestone Oct 31, 2017
@dsukhoroslov dsukhoroslov self-assigned this Nov 12, 2017
@dsukhoroslov dsukhoroslov reopened this Nov 13, 2017
dsukhoroslov added a commit that referenced this issue Nov 14, 2017
@dsukhoroslov dsukhoroslov removed this from the Maintenance release 1.2 milestone Feb 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants