juicedata/juicefs · error

HGet sessionInfos %s: %s

Error message

HGet sessionInfos %s: %s

What it means

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.

Source

Thrown at pkg/meta/redis.go:542

			_, err = tx.TxPipelined(ctx, func(pipe redis.Pipeliner) error {
				pipe.Set(ctx, name, value, 0)
				m.genLog(ctx, pipe, time.Now(), "SET(%s,%d)", logEncode2(origName), value)
				return nil
			})
			return err
		}
	}, name)

	return changed, err
}

func (m *redisMeta) getSession(sid string, detail bool) (*Session, error) {
	ctx := Background()
	info, err := m.rdb.HGet(ctx, m.sessionInfos(), sid).Bytes()
	if err == redis.Nil { // legacy client has no info
		info = []byte("{}")
	} else if err != nil {
		return nil, fmt.Errorf("HGet sessionInfos %s: %s", sid, err)
	}
	var s Session
	if err := json.Unmarshal(info, &s); err != nil {
		return nil, fmt.Errorf("corrupted session info; json error: %s", err)
	}
	s.Sid, _ = strconv.ParseUint(sid, 10, 64)
	if detail {
		inodes, err := m.rdb.SMembers(ctx, m.sustained(s.Sid)).Result()
		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()

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Check the wrapped Redis error in the message and address its cause (connectivity, auth, memory).
  2. Verify Redis health: redis-cli -h <host> PING and INFO.
  3. Fix credentials if NOAUTH (set REDIS_PASSWORD or correct the URL).
  4. Retry the status/list command after transient network or failover issues.

Example fix

// before
$ juicefs status redis://127.0.0.1:6379/1
// HGet sessionInfos 2: dial tcp 127.0.0.1:6379: connect: connection refused
// after: start/point to the right Redis
$ systemctl start redis
$ juicefs status redis://127.0.0.1:6379/1
Defensive patterns

Strategy: retry

Validate before calling

// check Redis reachability before querying sessions
if err := rdb.Ping(ctx).Err(); err != nil {
    return fmt.Errorf("redis unreachable, cannot list sessions: %w", err)
}

Try / catch

sessions, err := meta.ListSessions(ctx)
if err != nil {
    if strings.Contains(err.Error(), "HGet sessionInfos") {
        // Redis-level failure: retry once after a short backoff, then surface
        time.Sleep(time.Second)
        sessions, err = meta.ListSessions(ctx)
    }
    return err
}

Prevention

When it happens

Trigger: Running juicefs status or ListSessions while Redis is unreachable, times out, returns NOAUTH/OOM/CLUSTERDOWN, or the connection breaks mid-command.

Common situations: Redis under load causing command timeouts; expired credentials (NOAUTH); network interruption between the CLI client and Redis; cluster failover while querying sessions.

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/9b2ed9eebfe51778. Report an issue: GitHub.