mirror of
https://github.com/go-gitea/gitea.git
synced 2026-03-09 12:46:42 -05:00
"data/sessions" folder growed up and used 100% inodes #3044
Closed
opened 2025-11-02 04:58:42 -06:00 by GiteaMirror
·
19 comments
No Branch/Tag Specified
main
release/v1.25
release/v1.24
release/v1.23
release/v1.22
release/v1.21
release/v1.20
release/v1.19
release/v1.18
release/v1.17
release/v1.16
release/v1.15
release/v1.14
release/v1.13
release/v1.12
release/v1.11
release/v1.10
release/v1.9
release/v1.8
v1.25.3
v1.25.2
v1.25.1
v1.25.0
v1.24.7
v1.25.0-rc0
v1.26.0-dev
v1.24.6
v1.24.5
v1.24.4
v1.24.3
v1.24.2
v1.24.1
v1.24.0
v1.23.8
v1.24.0-rc0
v1.25.0-dev
v1.23.7
v1.23.6
v1.23.5
v1.23.4
v1.23.3
v1.23.2
v1.23.1
v1.23.0
v1.23.0-rc0
v1.24.0-dev
v1.22.6
v1.22.5
v1.22.4
v1.22.3
v1.22.2
v1.22.1
v1.22.0
v1.23.0-dev
v1.22.0-rc1
v1.21.11
v1.22.0-rc0
v1.21.10
v1.21.9
v1.21.8
v1.21.7
v1.21.6
v1.21.5
v1.21.4
v1.21.3
v1.21.2
v1.20.6
v1.21.1
v1.21.0
v1.21.0-rc2
v1.21.0-rc1
v1.20.5
v1.22.0-dev
v1.21.0-rc0
v1.20.4
v1.20.3
v1.20.2
v1.20.1
v1.20.0
v1.19.4
v1.21.0-dev
v1.20.0-rc2
v1.20.0-rc1
v1.20.0-rc0
v1.19.3
v1.19.2
v1.19.1
v1.19.0
v1.19.0-rc1
v1.20.0-dev
v1.19.0-rc0
v1.18.5
v1.18.4
v1.18.3
v1.18.2
v1.18.1
v1.18.0
v1.17.4
v1.18.0-rc1
v1.19.0-dev
v1.18.0-rc0
v1.17.3
v1.17.2
v1.17.1
v1.17.0
v1.17.0-rc2
v1.16.9
v1.17.0-rc1
v1.18.0-dev
v1.16.8
v1.16.7
v1.16.6
v1.16.5
v1.16.4
v1.16.3
v1.16.2
v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.4.0-rc1
v1.3.2
v1.3.1
v1.3.0
v1.3.0-rc2
v1.3.0-rc1
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.2.0-rc3
v1.2.0-rc2
v1.1.4
v1.2.0-rc1
v1.1.3
v1.1.2
v1.1.1
v1.1.0
v1.0.2
v1.0.1
v1.0.0
v0.9.99
Labels
Clear labels
$20
$250
$50
$500
backport/done
💎 Bounty
docs-update-needed
good first issue
hacktoberfest
issue/bounty
issue/confirmed
issue/critical
issue/duplicate
issue/needs-feedback
issue/not-a-bug
issue/regression
issue/stale
issue/workaround
lgtm/need 2
modifies/api
modifies/translation
outdated/backport/v1.18
outdated/theme/markdown
outdated/theme/timetracker
performance/bigrepo
performance/cpu
performance/memory
performance/speed
pr/breaking
proposal/accepted
proposal/rejected
pr/wip
pull-request
reviewed/wontfix
💰 Rewarded
skip-changelog
status/blocked
topic/accessibility
topic/api
topic/authentication
topic/build
topic/code-linting
topic/commit-signing
topic/content-rendering
topic/deployment
topic/distribution
topic/federation
topic/gitea-actions
topic/issues
topic/lfs
topic/mobile
topic/moderation
topic/packages
topic/pr
topic/projects
topic/repo
topic/repo-migration
topic/security
topic/theme
topic/ui
topic/ui-interaction
topic/ux
topic/webhooks
topic/wiki
type/bug
type/deprecation
type/docs
type/enhancement
type/feature
type/miscellaneous
type/proposal
type/question
type/refactoring
type/summary
type/testing
type/upstream
Mirrored from GitHub Pull Request
No Label
type/bug
Milestone
No items
No Milestone
Projects
Clear projects
No project
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/gitea#3044
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Perflyst on GitHub (Mar 13, 2019).
[x]):Description
Today I got a warning from my monitoring that the gitea machine has no more inodes left. Gitea crashed and you couldnt write on the disk anymore. I removed
data/sessions/*which had incredible much inodes.Is there any work around? Is this a bug? Why does it grow soo much?
@lunny commented on GitHub (Mar 14, 2019):
If too many users are visiting your gitea site, it will create many session files that maybe use many inodes. You can change your session provider to memory, redis, mysql and etc. Currently you could delete all the session files to let gitea work, but then everyone have to login gitea again.
@Perflyst commented on GitHub (Mar 14, 2019):
If I use memory than probably all users are logged out if I restart gitea.
It just filled up again 80% inodes. Why do you not delete the session files automatically if the user just visits the site without logging in?
@FloThinksPi commented on GitHub (Mar 15, 2019):
@Perflyst @lunny We also see this problem. We have aprox 200 Users, but Gitea seems to create a session file for each request! The save sessions in file function is obviously broken in 1.7.4. We see around 100 to 1000 Files per second beeing created. Our System Crashed at 20GBs and 5 Million files in the sessions folder. This is due to Docker trying to relable the selinux labels of all the files (:Z option in docker-compose) which leads to the docker deamon to hang/crash.
Our Configuration was:
Because we thought maybe the defaults are wrong we tried:
But no change whatsoever.
@Perflyst We solved it by changing the method from file to memory, wich is only suitable on singe instance server. If you have multiple gitea servers working in LoadBalancing configuration you would need to setup a redis to work around it.
Everytime you clear the sessions folder all users will have to login again, so next time you can just change to memory where all users have to log in gain also and afterwards delete the sessions folder wich is not needed anymore now.
Interresting also for @inxonic
@Perflyst commented on GitHub (Mar 15, 2019):
Just as a side note, I do not use docker (if this is relevant).
I will change to memory but still this can't be right. It worked before without 1.7.3 / .4 these much session files.
@FloThinksPi commented on GitHub (Mar 15, 2019):
Yours crashed because you reached your inode limit, mine crashed earlier because the docker deamon refused its work :), it is not relevant for the problem. 5 Million Session files would be OK with 5 Million Users Logging in all within a 1 Day timeframe. However in our case and user counts there should be around 100 Session files normally. Something is fishy with session handling when using files.
Last Commit in /sessions/file.go was
9de871a0f8which Added following lines:9de871a0f8/vendor/github.com/go-macaron/session/file.go (L84-L87)But i cannot see how this could case such issues.
@FloThinksPi commented on GitHub (Mar 15, 2019):
@techknowlogick as you seem familliar with the session handling and file method, could you have a look on this ?
@lunny commented on GitHub (Mar 15, 2019):
@Perflyst @FloThinksPi could you confirm that v1.7.2 work for you?
@FloThinksPi commented on GitHub (Mar 15, 2019):
@lunny our last version was commit
20c54f88b2. We updated straight from that "non release" version to 1.7.4. In20c54f88b2we did not see this issue, though we had other crashed so our instance might crashed before we could obseve the session issue. But i think we would have noticed that many files so i would say in20c54f88b2it was not present.@Perflyst commented on GitHub (Mar 15, 2019):
I can confirm that my monitoring never informed me about 80% inodes usage before 1.7.3
@FloThinksPi commented on GitHub (Mar 18, 2019):
@Perflyst @lunny today our instace ran out of memory at 12+GB(8GB+4GB SWAP). So the bug is also present when using memory unfortunally. Though it takes much more time to fill the 12GB RAM+SWAP in comparison to filling 12GB Disk Space when using file.
@techknowlogick commented on GitHub (Mar 18, 2019):
@FloThinksPi have you tried using redis as session provider?
@zeripath commented on GitHub (Mar 19, 2019):
@techknowlogick I think there is probably a real issue here. Drive by visitors should not be having server sessions created. This never used to happen - something is writing to these sessions and we need to stop it.
@Perflyst is there anything suggestive of the cause in the session files to work out what is adding this data?
@Perflyst commented on GitHub (Mar 19, 2019):
Well, this just kills my terminal
I noticed that the session folder also grows if there are no visitors. It seems like the sync from a mirror also fills the session folder.
I don't know if this is relevant, but I see a lot
2019/03/19 08:40:28 [...ules/context/repo.go:625 func1()] [E] GetCommitsCount: Unsupported cached value type: <nil>in the gitea.log file@FloThinksPi commented on GitHub (Mar 19, 2019):
@techknowlogick we only tried memory and file, which seem to behave the same.
I browsed a litte trough the last commits and found something interresting.
820e28c904/vendor/github.com/go-macaron/session/file.go (L126-L164)The Read function in managers providers does crate a file if none is found yet. So it does not only read, it will also write new sessions. Maybe one should split this functionality but nevermind for this issue.
So in:
9de871a0f8A validator function got intoduced. Now every call should include this validator function.
However in the same commit where the validator function was introduced, the call to the Read function changed from m.Read to m.provider.read:
So in my opinion this would bypass the managers read function and directly call the provides read function which does not validate the session further.
f7f2f12b68/vendor/github.com/go-macaron/session/session.go (L311-L319)I dont know if this could cause this but maybe invalid sessions are provided here to the read function and it creates them without further checks ? Just a guess here.
@lunny commented on GitHub (Mar 19, 2019):
I found v1.7.2 still has this problem, not only v1.7.4. When I refresh home page,
/manifest.jsonwill get a new session id every time.@Perflyst commented on GitHub (Mar 19, 2019):
it is also present in 1.8rc1
On March 19, 2019 12:06:10 PM UTC, Lunny Xiao notifications@github.com wrote:
@lunny commented on GitHub (Mar 19, 2019):
I think session on this route could be disabled since it's public and only for PWA.
@lunny commented on GitHub (Mar 19, 2019):
@Perflyst @FloThinksPi could you confirm that #6372 fixed your problem and I will send back port to v1.8 and v1.7.5 after it's merged on master.
@Perflyst commented on GitHub (Mar 19, 2019):
Can you share a binary? linux-amd64, if possible.