pgx.ReplicationConn consists of a pgx.Conn internally, of which the documentation states:
Conn is a PostgreSQL connection handle. It is not safe for concurrent usage. Use ConnPool to manage access to multiple database connections from multiple goroutines.
In db/lr.go the method sendPeriodicHeartbeats() is accessing the session.ReplConn concurrently with the main loop in LRStream.