Search in sources :

Example 1 with PackOutputClosedException

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());
}
Also used : PackOutputClosedException(org.neo4j.bolt.packstream.PackOutputClosedException) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider)

Example 2 with PackOutputClosedException

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>");
}
Also used : Neo4jError(org.neo4j.bolt.runtime.Neo4jError) TransactionTerminatedException(org.neo4j.graphdb.TransactionTerminatedException) PackOutputClosedException(org.neo4j.bolt.packstream.PackOutputClosedException) AssertableLogProvider(org.neo4j.logging.AssertableLogProvider) Test(org.junit.jupiter.api.Test)

Aggregations

PackOutputClosedException (org.neo4j.bolt.packstream.PackOutputClosedException)2 AssertableLogProvider (org.neo4j.logging.AssertableLogProvider)2 Test (org.junit.jupiter.api.Test)1 Neo4jError (org.neo4j.bolt.runtime.Neo4jError)1 TransactionTerminatedException (org.neo4j.graphdb.TransactionTerminatedException)1