0

Recently discovered a problem such a problem. I am using a reactive application written in Spring boot 3.x. , r2dbc postgresql, spring webflux

At the time of processing the request, the connection to the database is lost and we get an error:

CannotCreateTransactionException

The cause of this error is a

io.r2dbc.postgresql.client.ReactorNettyClient$PostgresConnectionException: [08006] An I/O error occurred while sending to the backend or receiving from the backend

  • detailMessage

An I/O error occurred while sending to the backend or receiving from the backend

and also

java.io.IOException: Operation timed out

However, when resuming access to the database, the application must be restarted, since all subsequent requests will receive the same error.

Who has any ideas how to get around this kind of error?

That is, so that when the connection is resumed, it is possible to send requests without restarting the application.

Maybe someone can explain the model of this behavior io.r2dbc.postgresql.client.ReactorNettyClient. Why do I have to restart the service to initialize the datasource again. Is it possible to get around this and how ?

For example, at the time of receiving such an error, is it possible to re-initialize the connection to the database without restarting the service, managing from the code?

skyho
  • 1,438
  • 2
  • 20
  • 47

1 Answers1

0

I used this approach.

*
url: r2dbc:pool:postgresql://host:5432/name_db


    implementation 'io.r2dbc:r2dbc-pool:1.0.0.RELEASE'
    runtimeOnly 'org.postgresql:r2dbc-postgresql'

org.postgresql:r2dbc-postgresql'. - it is necessary to use

skyho
  • 1,438
  • 2
  • 20
  • 47