Error: F_JD02FD: PostgreSQL Streaming Replication Error
Issue
Channel capture fails during PostgreSQL logical replication with the following error:
F_JD02FD: PostgreSQL Streaming Replication error while retrieving PostgreSQL logical log records: -2 : SSL SYSCALL error: EOF detected. LOG: terminating walsender process due to replication timeout
Environment
- HVR 6
- Source: PostgreSQL
Resolution
To resolve this issue:
Adjust the PostgreSQL server settings:
i. Set
wal_sender_timeoutto0to disable the walsender timeout, or increase it to a longer interval, such as 5 minutes.ii. Set
HVR_PQ_STREAMING_REPLICATION_WAIT_MAXto1024using an HVR environment action.iii. Set
HVR_PQ_STREAMING_REPLICATION_RESTART_AT_END_OF_WALto 0 using an HVR environment action.iv. Reactivate the channel to apply the environment variable changes.
Check the replication slot by running the following query. Replace
hvr_<channel_name>with your replication slot name:SELECT slot_name, active, restart_lsn, confirmed_flush_lsn FROM pg_replication_slots WHERE slot_name = 'hvr_<channel_name>';If the slot is missing or invalidated, perform a full data refresh.
Create a heartbeat table and use a cron job to update it every 15 minutes. This generates periodic transactions that help prevent inactivity. PostgreSQL doesn't include a built-in scheduler, so an external schedule such as cron is required.
For more information, see Stuck or Slow Replication Slot.
Cause
This issue occurs when database activity is low and the replication connection times out, or when heavy transaction loads delay data streaming. If the server doesn't receive a keepalive message or acknowledgment within the configured timeout period, it terminates the connection.