Skip to content

Runs out of memory during syncing and crashes #2

Open

Description

@HalFinneyIsMyHomeBoy

Trying to sync on mainnet for a few days now, but it runs out of memory and the process kills itself.
Syncing from block 709632. Server has 64 GB of RAM.

Is more RAM needed or is this a bug?

Activity

  1. tsjk commented on Feb 4, 2025

    @tsjk

    Did you manage to work around this issue?

  2. HalFinneyIsMyHomeBoy commented on Feb 4, 2025

    @HalFinneyIsMyHomeBoy
    Author

    No, never got around this issue. Gave up on it a few months back.
    Has there been any fix since then?

  3. tsjk commented on Feb 4, 2025

    @tsjk

    No, never got around this issue. Gave up on it a few months back. Has there been any fix since then?

    No, there hasn't. But I experienced the same issue. I think the problem is that computing the scalars goes much faster than updating the unspents, and so
    https://github.com/louisinger/silentiumd/blob/master/internal/application/syncer_service.go#L217-L219
    becomes a very long memory consuming queue. I don't know any go, really - just looked at the code quickly. The code base is small.
    One can change this to become a blocking call by just

    --- a/internal/application/syncer_service.go
    +++ b/internal/application/syncer_service.go
    @@ -214,11 +214,8 @@ func (s *syncer) computeBlockScalars(block *btcutil.Block) {
                    logrus.Error(err)
            }
     
    -       go func() {
    -               s.updateUnspentsCh <- block
    -       }()
    -
            logrus.Debugf("[%d] compute scalars done", block.Height())
    +       s.updateUnspentsCh <- block
     }
     
     func (s *syncer) updateUnspents(block *btcutil.Block) {
    

    and this makes it not eat all your memory. But syncing is very slow.
    I know there is at least one other implementation, also in go. Maybe worth to check out - depending on what you want to do.

  4. tsjk commented on Feb 4, 2025

    @tsjk

    Perhaps there is a middle-ground somewhere, like limiting the queue size, but as I don't know golang I have no concrete ideas.

  5. setavenger commented on Feb 4, 2025

    @setavenger

    I know there is at least one other implementation, also in go. Maybe worth to check out - depending on what you want to do.

    I assume you are referencing my implementation with the BlindBit suite. https://github.com/setavenger/blindbit-oracle
    I'm not aware of any memory issues with Oracle, so give it a try if you want to.

  6. tsjk commented on Feb 4, 2025

    @tsjk

    I know there is at least one other implementation, also in go. Maybe worth to check out - depending on what you want to do.

    I assume you are referencing my implementation with the BlindBit suite. https://github.com/setavenger/blindbit-oracle I'm not aware of any memory issues with Oracle, so give it a try if you want to.

    Indeed I was. Will look at that more closely as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions