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

cannot allocate memory after opening truncated diff (possible memory leak) #2669

Closed
2 of 7 tasks
mrexodia opened this issue Oct 6, 2017 · 4 comments
Closed
2 of 7 tasks
Labels

Comments

@mrexodia
Copy link
Contributor

mrexodia commented Oct 6, 2017

Description

Log

2017/10/06 21:18:00 [I] Log Mode: File(Info)
2017/10/06 21:18:01 [I] XORM Log Mode: File(Info)
2017/10/06 21:18:01 [I] Cache Service Enabled
2017/10/06 21:18:01 [I] Session Service Enabled
2017/10/06 21:18:01 [I] Mail Service Enabled
2017/10/06 21:18:01 [I] Register Mail Service Enabled
2017/10/06 21:18:01 [I] Notify Mail Service Enabled
2017/10/06 21:18:01 [I] Git Version: 2.1.4
2017/10/06 21:18:01 [I] SQLite3 Supported
2017/10/06 21:18:01 [I] Run Mode: Production
2017/10/06 21:18:04 [I] Listen: http://0.0.0.0:3000
2017/10/06 21:35:22 [...ules/context/repo.go:318 func1()] [E] GetTags: fork/exec /usr/bin/git: cannot allocate memory
2017/10/06 21:35:26 [...ules/context/repo.go:318 func1()] [E] GetTags: fork/exec /usr/bin/git: cannot allocate memory
2017/10/06 21:36:37 [...ules/context/repo.go:318 func1()] [E] GetTags: fork/exec /usr/bin/git: cannot allocate memory
2017/10/06 21:36:38 [...ules/context/repo.go:318 func1()] [E] GetTags: fork/exec /usr/bin/git: cannot allocate memory
2017/10/06 21:36:39 [...ules/context/repo.go:318 func1()] [E] GetTags: fork/exec /usr/bin/git: cannot allocate memory

Screenshots

Here is a video showing exactly how I reproduced the problem on a just-started gitea instance. I tried this about 4 times and it happens every time. It might be possible to reproduce on a system with more memory by cloning this repo multiple times and opening the offending diff a bunch of times as well, but I didn't test this yet.

https://youtu.be/RynWvzilbaQ

@mrexodia mrexodia changed the title cannot allocate memory after opening big diff (possible memory leak) cannot allocate memory after opening truncated diff (possible memory leak) Oct 6, 2017
@lafriks lafriks added this to the 1.x.x milestone Oct 7, 2017
@mrexodia
Copy link
Contributor Author

mrexodia commented Nov 27, 2017

The main cause of the issue I described here is fixed #2990, however I found that Blob.Data is another cause of excessive memory usage. This is a list of things that use this function

  • IsImageFile
  • GetEditorconfig (should this respect Settings.UI.MaxDisplayFileSize?)
  • ServeBlob
  • editFile (should this respect Settings.UI.MaxDisplayFileSize?)
  • getFileContentFromDefaultBranch (should this respect Settings.UI.MaxDisplayFileSize?)
  • renderDirectory (readme, @lafriks said this should respect Settings.UI.MaxDisplayFileSize)
  • renderFile (this reads all of the blob before checking Settings.UI.MaxDisplayFileSize so it might as well not check)
  • wiki.go (should this respect Settings.UI.MaxDisplayFileSize?) see wiki.go should respect Settings.UI.MaxDisplayFileSize #5289

Currently I cannot really continue before go-gitea/git#94 is merged, but I will prepare a branch on my repo with all the things fixed so people can test/review my changes. You can find my current fixes here.

@lafriks
Copy link
Member

lafriks commented Nov 28, 2017

go-gitea/git#94 is merged

@lunny
Copy link
Member

lunny commented Nov 7, 2018

@mrexodia should this be closed and make a new issue for the only one wiki.go issue?

@mrexodia
Copy link
Contributor Author

mrexodia commented Nov 7, 2018

No problem for me, whatever you think is better for the project :)

@lunny lunny removed this from the 1.x.x milestone Nov 7, 2018
@lunny lunny closed this as completed Nov 7, 2018
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants