use of org.neo4j.bolt.packstream.PackOutputClosedException in project neo4j by neo4j.
the class MessageProcessingHandlerTest method testLoggingOfOriginalErrorWhenOutputIsClosed.
private static void testLoggingOfOriginalErrorWhenOutputIsClosed(Neo4jError original) throws Exception {
PackOutputClosedException outputClosed = new PackOutputClosedException("Output closed", "<client>");
AssertableLogProvider logProvider = emulateFailureWritingError(original, outputClosed);
assertThat(logProvider).forClass(MessageProcessingHandlerTest.class).forLevel(WARN).containsMessageWithException("Unable to send error back to the client", original.cause());
}
use of org.neo4j.bolt.packstream.PackOutputClosedException in project neo4j by neo4j.
the class MessageProcessingHandlerTest method shouldLogShortWarningOnClientDisconnectMidwayThroughQuery.
@Test
void shouldLogShortWarningOnClientDisconnectMidwayThroughQuery() throws Exception {
// Connections dying is not exceptional per-se, so we don't need to fill the log with
// eye-catching stack traces; but it could be indicative of some issue, so log a brief
// warning in the debug log at least.
// Given
PackOutputClosedException outputClosed = new PackOutputClosedException("Output closed", "<client>");
Neo4jError txTerminated = Neo4jError.from(new TransactionTerminatedException(Status.Transaction.Terminated));
// When
AssertableLogProvider logProvider = emulateFailureWritingError(txTerminated, outputClosed);
// Then
assertThat(logProvider).forClass(getClass()).forLevel(WARN).containsMessageWithArguments("Client %s disconnected while query was running. Session has been cleaned up. " + "This can be caused by temporary network problems, but if you see this often, ensure your " + "applications are properly waiting for operations to complete before exiting.", "<client>");
}
Aggregations