spring-projects / spring-data-neo4j

Provide support to increase developer productivity in Java when using Neo4j. Uses familiar Spring concepts such as a template classes for core API usage and lightweight repository style data access.
http://spring.io/projects/spring-data-neo4j
Apache License 2.0
834 stars 618 forks source link

RetryExceptionPredicate has the wrong error messages #2944

Closed GregDThomas closed 2 months ago

GregDThomas commented 2 months ago

org.springframework.data.neo4j.core.support.RetryExceptionPredicate contains two exception messages that are retryable;

private static final Set<String> RETRYABLE_ILLEGAL_STATE_MESSAGES = Set.of(
            "Transaction must be open, but has already been closed.",
            "Session must be open, but has already been closed.");

Neither of these messages appear anywhere in the code base. However, very similar messages (without a trailing dot) appear in exceptions raised in org.springframework.data.neo4j.core.transaction.Neo4jTransactionHolder. Given these exceptions should be retryable, these exception messages should match.

(Background; we've been wondering why some exceptions weren't being retried in our code base - finally narrowed it down to this!)

michael-simons commented 2 months ago

Excellent catch! Gonna run your build quickly, then merge it.

The background here: A while back, it was agreed Spring wide that trailing dots in exception messages should be removed. Well, that's what I get for not having constants for that in the first place. Thank you!

GregDThomas commented 2 months ago

I'm guessing this could/should be backported to 7.3.x, maybe 7.2.x depending on when the change was made?

michael-simons commented 2 months ago

I will take care of this for all supported branches. :)

GregDThomas commented 2 months ago

Thank you!