Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Too much warning "cannot get cache context when getting data" #23160

Closed
adlternative opened this issue Feb 26, 2023 · 8 comments · Fixed by #23186
Closed

Too much warning "cannot get cache context when getting data" #23160

adlternative opened this issue Feb 26, 2023 · 8 comments · Fixed by #23186
Assignees
Labels

Comments

@adlternative
Copy link

adlternative commented Feb 26, 2023

Description

A large number of cache warnings appear after pushing a large number of tags (about 2,000)

Gitea Version

1.20.0+dev (90a7bba)

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

image

Git Version

2.39.0.198

Operating System

archlinux

How are you running Gitea?

a command-line

gitea web

Database

MySQL

@adlternative adlternative changed the title Too much Warning "cannot get cache context when getting data" Too much warning "cannot get cache context when getting data" Feb 26, 2023
@lunny
Copy link
Member

lunny commented Feb 26, 2023

I think this has been fixed in #23054

@adlternative
Copy link
Author

I think this has been fixed in #23054

image

Well, I think it still triggered warns with Gitea latest version "1.20.0+dev-34-gb9a9b8e46 built with GNU Make 4.4, go1.20.1 : bindata"

@yp05327
Copy link
Contributor

yp05327 commented Feb 28, 2023

In #23054,

getting the system settings will not try from the cache but will read from the database directly.

It seems that cache will read from database directly when server starts. So is it possible that this context data is just not existed in the database?

@adlternative
Copy link
Author

In #23054,

getting the system settings will not try from the cache but will read from the database directly.

It seems that cache will read from database directly when server starts. So is it possible that this context data is just not existed in the database?

Agree, maybe so.

@lunny
Copy link
Member

lunny commented Feb 28, 2023

In #23054,

getting the system settings will not try from the cache but will read from the database directly.

It seems that cache will read from database directly when server starts. So is it possible that this context data is just not existed in the database?

The warning is not because of the record is not exist in database but cannot get the context cache key. I think #23186 will fix this.

jolheiser pushed a commit that referenced this issue Feb 28, 2023
Use context parameter in `services/repository`.

And use `cache.WithCacheContext(ctx)` to generate push action history
feeds.

Fix #23160
@adlternative
Copy link
Author

Thanks, I think it has been fixed!

@karolyi
Copy link

karolyi commented Mar 28, 2023

In what version should this have been fixed? I'm still getting them with 1.19.0:

2023/03/28 16:21:22 ...les/cache/context.go:71:SetContextData() [W] [6422f3fa-46] cannot get cache context when setting data: &{context.Background.WithCancel.WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer"}).WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer", "pid":"6422f3fa-46", "ppid":"", "process-description":"Incoming Email", "process-type":"system"}) 6422f3fa-46}
2023/03/28 16:21:22 ...les/cache/context.go:62:GetContextData() [W] [6422f3fa-46] cannot get cache context when getting data: &{context.Background.WithCancel.WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer"}).WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer", "pid":"6422f3fa-46", "ppid":"", "process-description":"Incoming Email", "process-type":"system"}) 6422f3fa-46}
2023/03/28 16:21:22 ...les/cache/context.go:71:SetContextData() [W] [6422f3fa-46] cannot get cache context when setting data: &{context.Background.WithCancel.WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer"}).WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer", "pid":"6422f3fa-46", "ppid":"", "process-description":"Incoming Email", "process-type":"system"}) 6422f3fa-46}
2023/03/28 16:21:22 ...les/cache/context.go:62:GetContextData() [W] [6422f3fa-46] cannot get cache context when getting data: &{context.Background.WithCancel.WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer"}).WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer", "pid":"6422f3fa-46", "ppid":"", "process-description":"Incoming Email", "process-type":"system"}) 6422f3fa-46}
2023/03/28 16:21:22 ...les/cache/context.go:71:SetContextData() [W] [6422f3fa-46] cannot get cache context when setting data: &{context.Background.WithCancel.WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer"}).WithCancel.WithValue(type pprof.labelContextKey, val {"graceful-lifecycle":"with-hammer", "pid":"6422f3fa-46", "ppid":"", "process-description":"Incoming Email", "process-type":"system"}) 6422f3fa-46}

@karolyi
Copy link

karolyi commented Mar 28, 2023

Oh, 1.20.0, supposedly. Let's wait a bit more then.

@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants