juicedata/juicefs · error

HGetAll %s: %s

Error message

HGetAll %s: %s

What it means

For each lock key owned by the session, getSession reads its owner->lock-data hash with HGetAll. A Redis error there is wrapped as `HGetAll <lock>: <err>` and aborts the detailed session lookup. This indicates a Redis-level failure (connectivity, auth, replica read-only, wrong key type) while enumerating flock/posix-lock owners, not a JuiceFS data problem.

Source

Thrown at pkg/meta/redis.go:569

		if err != nil {
			return nil, fmt.Errorf("SMembers %s: %s", sid, err)
		}
		s.Sustained = make([]Ino, 0, len(inodes))
		for _, sinode := range inodes {
			inode, _ := strconv.ParseUint(sinode, 10, 64)
			s.Sustained = append(s.Sustained, Ino(inode))
		}

		locks, err := m.rdb.SMembers(ctx, m.lockedKey(s.Sid)).Result()
		if err != nil {
			return nil, fmt.Errorf("SMembers %s: %s", sid, err)
		}
		s.Flocks = make([]Flock, 0, len(locks)) // greedy
		s.Plocks = make([]Plock, 0, len(locks))
		for _, lock := range locks {
			owners, err := m.rdb.HGetAll(ctx, lock).Result()
			if err != nil {
				return nil, fmt.Errorf("HGetAll %s: %s", lock, err)
			}
			isFlock := strings.HasPrefix(lock, m.prefix+"lockf")
			inode, _ := strconv.ParseUint(lock[len(m.prefix)+5:], 10, 64)
			for k, v := range owners {
				parts := strings.Split(k, "_")
				if parts[0] != sid {
					continue
				}
				owner, _ := strconv.ParseUint(parts[1], 16, 64)
				if isFlock {
					s.Flocks = append(s.Flocks, Flock{Ino(inode), owner, v})
				} else {
					s.Plocks = append(s.Plocks, Plock{Ino(inode), owner, loadLocks([]byte(v))})
				}
			}
		}
	}
	return &s, nil

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Run `redis-cli -u <meta-url> TYPE <lock-key>`; expect 'hash'. If WRONGTYPE, remove/repair the key, then retry.
  2. Fix underlying Redis errors: NOAUTH/WRONGPASS (credentials), READONLY (use primary), MOVED/CLUSTERDOWN (cluster health/endpoints).
  3. Retry on transient network errors; the error names the specific lock key so you can test that key directly.
  4. If the session is stale, purge the session and its lock keys instead of detailing it.
  5. Align ACL rules so the status client can read all `<prefix>lock*` keys.

Example fix

// before
owners, err := m.rdb.HGetAll(ctx, lock).Result() // HGetAll locked-lockf100: NOAUTH ...
// after: fix creds / target primary, then
$ juicefs status redis://correct-primary:6379/1 --session 42
Defensive patterns

Strategy: try-catch

Validate before calling

$ redis-cli -u "$META_URL" TYPE <prefix>lockf<ino>    # expect: hash
$ redis-cli -u "$META_URL" PING

Try / catch

sess, err := metaCli.GetSession(sid, true)
if err != nil {
	if strings.Contains(err.Error(), "HGetAll") {
		// transient Redis error while reading lock owners: retry with backoff
		time.Sleep(2 * time.Second)
		sess, err = metaCli.GetSession(sid, true)
	}
	if err != nil { return err }
}

Prevention

When it happens

Trigger: `juicefs status <meta-url> --session <sid>` with detail where one of the session's `lockf<ino>`/`lockp<ino>` keys errors on HGETALL: connection failure, WRONGTYPE (lock key replaced with non-hash), NOAUTH/ACL restriction, READONLY replica, or MOVED during cluster resharding.

Common situations: Auth/ACL changes on Redis between mount and status invocation, status run against a read-only replica endpoint, cluster reshard timeouts, or manual key manipulation in redis-cli changing lock key types.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/938b9eec03c5c907. Report an issue: GitHub.