hyperledger/fabric · error

as another peer node command is executing, wait for that com

Error message

as another peer node command is executing, wait for that command to complete its execution or terminate it before retrying

What it means

pauseOrResumeChannel (used by 'peer node pause-channel' and 'resume-channel') acquires an exclusive file lock (fileLock under the peer's fileLockPath) before mutating ledger state. If the lock is already held — by a concurrent pause/resume/reset/rollback/rebuild command or by a stale lock from a crashed process — the lock acquisition fails and the command aborts with this message.

Source

Thrown at core/ledger/kvledger/pause_resume.go:36

		return err
	}
	logger.Infof("The channel [%s] has been successfully paused", ledgerID)
	return nil
}

// ResumeChannel updates the channel status to active in ledgerProviders
func ResumeChannel(rootFSPath, ledgerID string) error {
	if err := pauseOrResumeChannel(rootFSPath, ledgerID, msgs.Status_ACTIVE); err != nil {
		return err
	}
	logger.Infof("The channel [%s] has been successfully resumed", ledgerID)
	return nil
}

func pauseOrResumeChannel(rootFSPath, ledgerID string, status msgs.Status) error {
	fileLock := leveldbhelper.NewFileLock(fileLockPath(rootFSPath))
	if err := fileLock.Lock(); err != nil {
		return errors.Wrap(err, "as another peer node command is executing,"+
			" wait for that command to complete its execution or terminate it before retrying")
	}
	defer fileLock.Unlock()

	idStore, err := openIDStore(LedgerProviderPath(rootFSPath))
	if err != nil {
		return err
	}
	defer idStore.db.Close()
	return idStore.updateLedgerStatus(ledgerID, status)
}

View on GitHub (pinned to 2736b63f8f)

Solutions

  1. Wait for the currently executing peer node command to finish, then retry your command.
  2. Find and terminate the other peer node command process (ps/pgrep for 'peer node').
  3. If the process crashed, confirm nothing holds the lock (lsof on the fileLock file), then delete the stale fileLock file under the peer's fileSystemPath and retry.
  4. Ensure only one peer process is configured to use this data directory.

Example fix

// before: parallel commands conflict
peer node pause-channel mychannel &
peer node resume-channel mychannel   # fails with lock error
// after: serialize them
peer node pause-channel mychannel
peer node resume-channel mychannel
Defensive patterns

Strategy: retry

Validate before calling

// before running pause/resume, verify no other peer command holds the lock
func lockIsFree(rootFSPath string) bool {
	f, err := os.OpenFile(filepath.Join(rootFSPath, "fileLock"), os.O_RDWR, 0o600)
	if err != nil {
		return false
	}
	defer f.Close()
	return unix.Flock(int(f.Fd()), unix.LOCK_EX|unix.LOCK_NB) == nil
}

Try / catch

err := pauseOrResumeChannelWithRetry(rootFSPath, ledgerID, status)
if err != nil && strings.Contains(err.Error(), "another peer node command is executing") {
	// wait and retry; do NOT delete the lock while a process may be alive
	return fmt.Errorf("retry after the running peer node command completes: %w", err)
}

Prevention

When it happens

Trigger: Running 'peer node pause-channel' or 'peer node resume-channel' while another ledger-mutating peer command holds the file lock in <peer fs path>/fileLock.

Common situations: Running two peer node admin commands in parallel (e.g. in parallel CI steps or scripts); a previous command crashed without releasing the lock leaving a stale lock file; two peers mistakenly configured with the same fileSystemPath.

Related errors


AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04). Data as JSON: /api/errors/8cc8664a2bba80d9. Report an issue: GitHub.