{"record":{"id":"9b2ed9eebfe51778","repo":"juicedata/juicefs","slug":"hget-sessioninfos-s-s","errorCode":null,"errorMessage":"HGet sessionInfos %s: %s","messagePattern":"HGet sessionInfos (.+?): (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/redis.go","lineNumber":542,"sourceCode":"\t\t\t_, err = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {\n\t\t\t\tpipe.Set(ctx, name, value, 0)\n\t\t\t\tm.genLog(ctx, pipe, time.Now(), \"SET(%s,%d)\", logEncode2(origName), value)\n\t\t\t\treturn nil\n\t\t\t})\n\t\t\treturn err\n\t\t}\n\t}, name)\n\n\treturn changed, err\n}\n\nfunc (m *redisMeta) getSession(sid string, detail bool) (*Session, error) {\n\tctx := Background()\n\tinfo, err := m.rdb.HGet(ctx, m.sessionInfos(), sid).Bytes()\n\tif err == redis.Nil { // legacy client has no info\n\t\tinfo = []byte(\"{}\")\n\t} else if err != nil {\n\t\treturn nil, fmt.Errorf(\"HGet sessionInfos %s: %s\", sid, err)\n\t}\n\tvar s Session\n\tif err := json.Unmarshal(info, &s); err != nil {\n\t\treturn nil, fmt.Errorf(\"corrupted session info; json error: %s\", err)\n\t}\n\ts.Sid, _ = strconv.ParseUint(sid, 10, 64)\n\tif detail {\n\t\tinodes, err := m.rdb.SMembers(ctx, m.sustained(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.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()","sourceCodeStart":524,"sourceCodeEnd":560,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/redis.go#L524-L560","documentation":"getSession reads a session's info blob from the sessionInfos hash via HGET; if HGET fails with an error other than redis.Nil, this error is returned (pkg/meta/redis.go:542). redis.Nil (field missing, i.e., a legacy client with no info) is handled gracefully, so this error means an actual Redis-level failure while fetching session details. It surfaces from juicefs status / juicefs session listing commands.","triggerScenarios":"Running juicefs status or ListSessions while Redis is unreachable, times out, returns NOAUTH/OOM/CLUSTERDOWN, or the connection breaks mid-command.","commonSituations":"Redis under load causing command timeouts; expired credentials (NOAUTH); network interruption between the CLI client and Redis; cluster failover while querying sessions.","solutions":["Check the wrapped Redis error in the message and address its cause (connectivity, auth, memory).","Verify Redis health: redis-cli -h <host> PING and INFO.","Fix credentials if NOAUTH (set REDIS_PASSWORD or correct the URL).","Retry the status/list command after transient network or failover issues."],"exampleFix":"// before\n$ juicefs status redis://127.0.0.1:6379/1\n// HGet sessionInfos 2: dial tcp 127.0.0.1:6379: connect: connection refused\n// after: start/point to the right Redis\n$ systemctl start redis\n$ juicefs status redis://127.0.0.1:6379/1","handlingStrategy":"retry","validationCode":"// check Redis reachability before querying sessions\nif err := rdb.Ping(ctx).Err(); err != nil {\n    return fmt.Errorf(\"redis unreachable, cannot list sessions: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"sessions, err := meta.ListSessions(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"HGet sessionInfos\") {\n        // Redis-level failure: retry once after a short backoff, then surface\n        time.Sleep(time.Second)\n        sessions, err = meta.ListSessions(ctx)\n    }\n    return err\n}","preventionTips":["Run status/session commands with correct credentials to avoid NOAUTH.","Check redis-cli PING and server load before querying on a busy cluster.","Retry transient failures; session listing is read-only and safe to re-run.","Use stable networking (keepalives, correct host) between the CLI and Redis."],"tags":["redis","session","network","query-failed"],"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-14T05:17:10.506Z"}