Caching issue is back #12011

Closed
opened 2025-11-02 09:54:31 -06:00 by GiteaMirror · 11 comments
Owner

Originally created by @somera on GitHub (Nov 14, 2023).

Description

I see this
2023/11/14 18:23:54 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 639.796µs
when I go to my profile and start page.

I'm using memcached.

Looks like #22281

Gitea Version

1.21.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

2.42.0

Operating System

Ubuntu 20.04.x

How are you running Gitea?

gitea-1.21.0-linux-amd64

Database

PostgreSQL

Originally created by @somera on GitHub (Nov 14, 2023). ### Description I see this `2023/11/14 18:23:54 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 639.796µs` when I go to my profile and start page. I'm using memcached. Looks like #22281 ### Gitea Version 1.21.1 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version 2.42.0 ### Operating System Ubuntu 20.04.x ### How are you running Gitea? gitea-1.21.0-linux-amd64 ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 09:54:31 -06:00
Author
Owner

@lunny commented on GitHub (Nov 15, 2023):

How many times the query occupied?

@lunny commented on GitHub (Nov 15, 2023): How many times the query occupied?
Author
Owner

@somera commented on GitHub (Nov 15, 2023):

3289 times on the start page.

My start page needs

image

After the upgrade to 1.21.0. Like in #22299

@somera commented on GitHub (Nov 15, 2023): 3289 times on the start page. My start page needs ![image](https://github.com/go-gitea/gitea/assets/8334250/0062c2e4-566b-4e18-93fd-ddfab1f32118) After the upgrade to 1.21.0. Like in #22299
Author
Owner

@wxiaoguang commented on GitHub (Nov 15, 2023):

Do you have the full log?


I think I know the problem now. Will propose a fix.

@wxiaoguang commented on GitHub (Nov 15, 2023): Do you have the full log? ---- I think I know the problem now. Will propose a fix.
Author
Owner

@wxiaoguang commented on GitHub (Nov 15, 2023):

-> Fix system config cache expiration timing #28072

@wxiaoguang commented on GitHub (Nov 15, 2023): -> Fix system config cache expiration timing #28072
Author
Owner

@somera commented on GitHub (Nov 15, 2023):

Do you have the full log?

Do you still need that?

@somera commented on GitHub (Nov 15, 2023): > Do you have the full log? Do you still need that?
Author
Owner

@wxiaoguang commented on GitHub (Nov 15, 2023):

Do you have the full log?

Do you still need that?

Not needed now, thank you very much!

@wxiaoguang commented on GitHub (Nov 15, 2023): > > Do you have the full log? > > Do you still need that? Not needed now, thank you very much!
Author
Owner

@somera commented on GitHub (Nov 15, 2023):

@wxiaoguang why is the query (in my case 3228 times)

2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 984.36µs
2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 561.283µs
2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 635.435µs
2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 634.959µs

needed on the http://domain/git/org/orgname/dashboard page for every orga? For the orga list?

@somera commented on GitHub (Nov 15, 2023): @wxiaoguang why is the query (in my case 3228 times) ``` 2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 984.36µs 2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 561.283µs 2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 635.435µs 2023/11/15 18:50:28 models/db/context.go:178:GetByBean() [I] [SQL] SELECT "id", "setting_key", "setting_value", "version", "created", "updated" FROM "system_setting" WHERE "setting_key"=$1 LIMIT 1 [revision] - 634.959µs ``` needed on the http://domain/git/org/orgname/dashboard page for every orga? For the orga list?
Author
Owner

@wxiaoguang commented on GitHub (Nov 16, 2023):

Because the "cache time" is not updated correctly, it is a bug. That's why https://github.com/go-gitea/gitea/pull/28072 fixes it.

@wxiaoguang commented on GitHub (Nov 16, 2023): Because the "cache time" is not updated correctly, it is a bug. That's why https://github.com/go-gitea/gitea/pull/28072 fixes it.
Author
Owner

@somera commented on GitHub (Nov 16, 2023):

@wxiaoguang I know that this is fixed. But I try to understand why so much queries are needed on the Dashboard page for an orga. But it make no sense to show the orga list on the dashboard page.

@somera commented on GitHub (Nov 16, 2023): @wxiaoguang I know that this is fixed. But I try to understand why so much queries are needed on the Dashboard page for an orga. But it make no sense to show the orga list on the dashboard page.
Author
Owner

@wxiaoguang commented on GitHub (Nov 16, 2023):

But I try to understand why so much queries are needed on the Dashboard page for an orga

The avatar module needs to read system settings to decide how to render an avatar. 1.21 contains an enhancement for the setting system, it brings the bug: the system setting revision was read again and again.

@wxiaoguang commented on GitHub (Nov 16, 2023): > But I try to understand why so much queries are needed on the Dashboard page for an orga The avatar module needs to read system settings to decide how to render an avatar. 1.21 contains an enhancement for the setting system, it brings the bug: the system setting revision was read again and again.
Author
Owner

@somera commented on GitHub (Nov 27, 2023):

Now the start page need

image

Looks good.

@somera commented on GitHub (Nov 27, 2023): Now the start page need ![image](https://github.com/go-gitea/gitea/assets/8334250/577ffec2-ed41-4ea0-8f49-c54aec5e557f) Looks good.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12011