# Persistence failure when replaying events and Failed to persist event with jdbc

**URL:** <https://discuss.akka.io/t/persistence-failure-when-replaying-events-and-failed-to-persist-event-with-jdbc/8275>\
**Category:** Persistence / Event Sourcing\
**Tags:** java, jdbc\
**Created:** [May 28, 2021, 9:32am UTC](https://discuss.akka.io/t/persistence-failure-when-replaying-events-and-failed-to-persist-event-with-jdbc/8275 "2021-05-28T09:32:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SF](https://avatars.discourse-cdn.com/v4/letter/s/58956e/32.png) [@SF](https://discuss.akka.io/u/SF)\
**Post date:** [May 28, 2021, 9:32am UTC](https://discuss.akka.io/t/persistence-failure-when-replaying-events-and-failed-to-persist-event-with-jdbc/8275/1 "2021-05-28T09:32:27Z")

</div>

Hi

On a raspberry pi compute module 3, we run akka classic with persistence (please find versions below).  
Persistence is very unreliable and we don’t know why. The errors we get are of the following two types:

1. `Persistence failure when replaying events for persistenceId [someId}]. Last known sequence number [7000] akka.pattern.CircuitBreaker$$anon$13: Circuit Breaker Timed out.`
2. `Failed to persist event type [someEvent] with sequence number [76817] for persistenceId [someId] akka.pattern.CircuitBreaker$$anon$13: Circuit Breaker Timed out.`

Our slick configuration in `application.conf` looks like:

```auto
slick {
  profile = "slick.jdbc.PostgresProfile$"
  db {
    url = "jdbc:postgresql://localhost:5432/databaseName?reWriteBatchedInserts=true"
    user = "someUser"
    password = "somePW"
    driver = "org.postgresql.Driver"

    // hikariCP
    numThreads = 4 // number of cores
    maxConnections = 4 // limit maxConnections to numThreads to avoid deadlocks
  }
}

```

#### Facts

1. there are only 7 persistent actors
2. we use postgresql as data storage, installed on the raspberry pi compute module
3. the errors occur with both versions of postgresql: 9.4 and 11.11
4. every minute, a cronjob removes entries marked as deleted from the postgresql table `event_journal` to prevent full storage
5. we apply [the standard schema](https://github.com/akka/akka-persistence-jdbc/blob/v5.0.0/core/src/main/resources/schema/postgres/postgres-create-schema.sql) to our postgresql database

#### Versions

akka version 2.6.10  
scala version 2.13  
slick version 3.3.3  
akka-persistence-jdbc version 5.0.0  
postgresql version 42.2.14 (from org.postgresql using maven)

#### Questions

1. How can we get more insight into what might cause the problem? (like enable more persistence logs, slick logs, …)
2. What can you tell from the error logs?
3. is there some configuration options to solve the problems?

Thanks
