js-libp2p-gossipsub icon indicating copy to clipboard operation
js-libp2p-gossipsub copied to clipboard

feat: implement putUnsafe() for time cache

Open twoeths opened this issue 3 years ago • 0 comments

Motivation

  • There is memory leak issue in the case of fastMsgIdFn hash function data collision, which causes validUntilMs to be not in ascending order and prune function does not work well
  • It's not only happen in #356, I think the current version of lodestar (v1.1.0) also has this issue that's why we have this pattern
Screen Shot 2022-10-07 at 15 38 12

In very bad case fastMsgIdCache could grow a lot.

Description

  • Implement putUnsafe() function
  • It's noticed that the putUnsafe() is 2x slower than put()

TODO

  • [ ] Test in a node for some time

twoeths avatar Oct 07 '22 08:10 twoeths