icon-project/centralized-relay

Duplicate packets added to msg cache during flushing

Closed this issue · 0 comments

Describe the bug
The relayer uses messageCache to keep track of the packets yet to be routed. However, it uses a pointer as its key due to which during flushing of the messages from db to memory, duplicate packets are added and it is increased after every flushing(default 5 mins) which causes issue in case of packets which need to be retried and are added multiple times causing rate limits as well in some scenario.

To Reproduce
Steps to reproduce the behavior:

  1. Provide shorter flushing duration
  2. The txn shouldn't succeed on first attempt but some how fail.
  3. Track the number of messages in msg cache after everyflushing

Expected behavior
The same packet should not be added if it is already in the cache.

Additional context
This issue is caused only if txns fail and need to be retried multiple times. The larger the time it takes to be successful, the more issue the packet will cause.