{"record":{"id":"938b9eec03c5c907","repo":"juicedata/juicefs","slug":"hgetall-s-s","errorCode":null,"errorMessage":"HGetAll %s: %s","messagePattern":"HGetAll (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/redis.go","lineNumber":569,"sourceCode":"\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"SMembers %s: %s\", sid, err)\n\t\t}\n\t\ts.Sustained = make([]Ino, 0, len(inodes))\n\t\tfor _, sinode := range inodes {\n\t\t\tinode, _ := strconv.ParseUint(sinode, 10, 64)\n\t\t\ts.Sustained = append(s.Sustained, Ino(inode))\n\t\t}\n\n\t\tlocks, err := m.rdb.SMembers(ctx, m.lockedKey(s.Sid)).Result()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"SMembers %s: %s\", sid, err)\n\t\t}\n\t\ts.Flocks = make([]Flock, 0, len(locks)) // greedy\n\t\ts.Plocks = make([]Plock, 0, len(locks))\n\t\tfor _, lock := range locks {\n\t\t\towners, err := m.rdb.HGetAll(ctx, lock).Result()\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"HGetAll %s: %s\", lock, err)\n\t\t\t}\n\t\t\tisFlock := strings.HasPrefix(lock, m.prefix+\"lockf\")\n\t\t\tinode, _ := strconv.ParseUint(lock[len(m.prefix)+5:], 10, 64)\n\t\t\tfor k, v := range owners {\n\t\t\t\tparts := strings.Split(k, \"_\")\n\t\t\t\tif parts[0] != sid {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\towner, _ := strconv.ParseUint(parts[1], 16, 64)\n\t\t\t\tif isFlock {\n\t\t\t\t\ts.Flocks = append(s.Flocks, Flock{Ino(inode), owner, v})\n\t\t\t\t} else {\n\t\t\t\t\ts.Plocks = append(s.Plocks, Plock{Ino(inode), owner, loadLocks([]byte(v))})\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\treturn &s, nil","sourceCodeStart":551,"sourceCodeEnd":587,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/redis.go#L551-L587","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","solutions":["Run `redis-cli -u <meta-url> TYPE <lock-key>`; expect 'hash'. If WRONGTYPE, remove/repair the key, then retry.","Fix underlying Redis errors: NOAUTH/WRONGPASS (credentials), READONLY (use primary), MOVED/CLUSTERDOWN (cluster health/endpoints).","Retry on transient network errors; the error names the specific lock key so you can test that key directly.","If the session is stale, purge the session and its lock keys instead of detailing it.","Align ACL rules so the status client can read all `<prefix>lock*` keys."],"exampleFix":"// before\nowners, err := m.rdb.HGetAll(ctx, lock).Result() // HGetAll locked-lockf100: NOAUTH ...\n// after: fix creds / target primary, then\n$ juicefs status redis://correct-primary:6379/1 --session 42","handlingStrategy":"try-catch","validationCode":"$ redis-cli -u \"$META_URL\" TYPE <prefix>lockf<ino>    # expect: hash\n$ redis-cli -u \"$META_URL\" PING","typeGuard":null,"tryCatchPattern":"sess, err := metaCli.GetSession(sid, true)\nif err != nil {\n\tif strings.Contains(err.Error(), \"HGetAll\") {\n\t\t// transient Redis error while reading lock owners: retry with backoff\n\t\ttime.Sleep(2 * time.Second)\n\t\tsess, err = metaCli.GetSession(sid, true)\n\t}\n\tif err != nil { return err }\n}","preventionTips":["Check TYPE of lock keys before any manual Redis surgery (must be hash).","Use the primary Redis endpoint for status commands.","Fix NOAUTH/WRONGPASS promptly; sync credentials across ops tooling.","Avoid resharding windows when running session listing.","Retry transient errors; the error names the exact failing lock key for direct diagnosis."],"tags":["redis","network","locks"],"backgroundTag":"database-query-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}