Skip to content

dashmate core reindex leaves reindex=1 in dash.conf when its restart fails #5855

Open

Description

@shumkov

Problem

A dashmate core reindex whose restart fails leaves reindex=1 in core/dash.conf, so a later Core start runs a full reindex that nobody asked for.

reindexNodeTask (packages/dashmate/src/listr/tasks/reindexNodeTaskFactory.js):

  1. "Start Core in reindex mode" renders core/dash.conf with reindex: true, writes it, and then runs restartNodeTask when the node is running.
  2. "Wait for Core start" writes the regular dash.conf again, without reindex=1, once Core is up.

If the restart fails, step 2 never runs. One cause is the stop task refusing because the masternode is in a DKG session. Dashmate re-renders service configs only when a config changed or was migrated (BaseCommand, config.isChanged()), so the file keeps reindex=1. The next time Core starts, for whatever reason, it reindexes the whole chain. On mainnet that means hours of downtime.

Found while reviewing the DKG-safe stop work (#5841 / #5843). It has been confirmed by reading the code, not reproduced.

Possible fixes

  • Run the stop's DKG check before writing reindex=1, so a refusal changes nothing.
  • And/or restore the regular dash.conf when the restart in step 1 fails (try/finally).

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions