Skip to content

fix(session): fix invalid data type in SessionRegenerate#22726

Merged
chlins merged 3 commits intogoharbor:mainfrom
liubin:fix-session-save-value-codec-error
Jan 19, 2026
Merged

fix(session): fix invalid data type in SessionRegenerate#22726
chlins merged 3 commits intogoharbor:mainfrom
liubin:fix-session-save-value-codec-error

Conversation

@liubin
Copy link
Copy Markdown
Contributor

@liubin liubin commented Jan 12, 2026

In some case,in my own I had run two core instance with redis is set to 127.0.0.1:6379(each core is connected to the redis instance in the same node), when login the portal, I got the error:

failed to save sid=0aea8ed3cb978163db227608b7662f03, where oldsid=7b7b626828df9e00911484c8c6693692, error: failed to encode value, key 0aea8ed3cb978163db227608b7662f03, error: object type invalid, ""

the codec in session is gobCodec, in its Encode func:

func (*gobCodec) Encode(v any) ([]byte, error) {
	if vm, ok := v.(map[any]any); ok {
		return session.EncodeGob(vm)
	}

	return nil, errors.Errorf("object type invalid, %#v", v)
}

The cache's Save can't accept an value of "", but should be map[any]any{}.

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Issue being fixed

Fixes #(issue)

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

Signed-off-by: Bin Liu <lb203159@antfin.com>
@liubin liubin requested a review from a team as a code owner January 12, 2026 02:13
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.87%. Comparing base (c8c11b4) to head (37765b9).
⚠️ Report is 619 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #22726       +/-   ##
===========================================
+ Coverage   45.36%   65.87%   +20.50%     
===========================================
  Files         244     1073      +829     
  Lines       13333   116279   +102946     
  Branches     2719     2931      +212     
===========================================
+ Hits         6049    76594    +70545     
- Misses       6983    35438    +28455     
- Partials      301     4247     +3946     
Flag Coverage Δ
unittests 65.87% <100.00%> (+20.50%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/core/session/session.go 37.60% <100.00%> (ø)

... and 987 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chlins chlins added the release-note/update Update or Fix label Jan 12, 2026
Copy link
Copy Markdown
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Copy link
Copy Markdown
Contributor

@wy65701436 wy65701436 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chlins chlins merged commit fbc0ebd into goharbor:main Jan 19, 2026
12 checks passed
intojhanurag pushed a commit to intojhanurag/harbor that referenced this pull request Jan 22, 2026
)

Signed-off-by: Bin Liu <lb203159@antfin.com>
Co-authored-by: Bin Liu <lb203159@antfin.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release-note/update Update or Fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants