cannot allocate memory #327

Closed
opened 2025-11-02 03:18:48 -06:00 by GiteaMirror · 1 comment
Owner

Originally created by @porjo on GitHub (Feb 8, 2017).

  • Gitea version (or commit ref): 1.0.1
  • Git version:1.8.3.1
  • Operating system: Centos7
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • SQLite

Description

I'm playing with Gitea on an AWS t2.micro instance (1G RAM) and running into memory issues. I attempted to push a moderate size repo up and it failed like so:

$ git push gitea Dev
Username for 'http://x.x.x.x': porjo
Password for 'http://porjo@x.x.x.x': 
Counting objects: 58543, done.
Compressing objects: 100% (18180/18180), done.
Writing objects: 100% (58543/58543), 133.41 MiB | 37.76 MiB/s, done.
Total 58543 (delta 41293), reused 56418 (delta 39647)
error: RPC failed; result=22, HTTP code = 500
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly
Everything up-to-date
$ 

(the repo I was pushing is a total of 384MB on disk (including .git folder).)

Now when I use the Gitea web frontend I keep getting error 500 messages, and the Gitea console log keeps display 'cannot allocate memory' errors. e.g. I attempt to create a new repository via the web frontend, and see this is in the log file:

2017/02/08 03:09:22 [T] action.newRepoAction: porjo/iantest2
2017/02/08 03:09:22 [...routers/repo/repo.go:103 handleCreateError()] [E] CreatePost: initRepository: InitRepository: fork/exec /usr/bin/git: cannot allocate memory
[Macaron] 2017-02-08 03:09:22: Completed /repo/create 500 Internal Server Error in 5.075568ms
2017/02/08 03:09:22 [D] Template: status/500

Top shows Gitea consuming in excess of 400MB!

top - 03:25:49 up 35 min,  2 users,  load average: 0.00, 0.01, 0.05
Tasks: 110 total,   2 running, 108 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem :  1015348 total,   210440 free,   520656 used,   284252 buff/cache
KiB Swap:        0 total,        0 free,        0 used.   330864 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S %CPU %MEM     TIME+ COMMAND                                                                                                                     
 2292 root      20   0  831856 449520  10332 S  0.0 44.3   0:01.19 gitea

I can understand why it might get upset about the initial push, but I would expect it to fail more gracefully. Why would it a) continue to consume so much memory b) not be able to allocate more memory for a simple operation (create repo) when there is still 210MB free!?

I've stopped and started Gitea and it has returned to normal. Attempting to push the same repo again causes the same issue.

Originally created by @porjo on GitHub (Feb 8, 2017). - Gitea version (or commit ref): 1.0.1 - Git version:1.8.3.1 - Operating system: Centos7 - Database (use `[x]`): - [ ] PostgreSQL - [ ] MySQL - [x] SQLite ## Description I'm playing with Gitea on an AWS t2.micro instance (1G RAM) and running into memory issues. I attempted to push a moderate size repo up and it failed like so: ``` $ git push gitea Dev Username for 'http://x.x.x.x': porjo Password for 'http://porjo@x.x.x.x': Counting objects: 58543, done. Compressing objects: 100% (18180/18180), done. Writing objects: 100% (58543/58543), 133.41 MiB | 37.76 MiB/s, done. Total 58543 (delta 41293), reused 56418 (delta 39647) error: RPC failed; result=22, HTTP code = 500 fatal: The remote end hung up unexpectedly fatal: The remote end hung up unexpectedly Everything up-to-date $ ``` (the repo I was pushing is a total of 384MB on disk (including .git folder).) Now when I use the Gitea web frontend I keep getting error 500 messages, and the Gitea console log keeps display 'cannot allocate memory' errors. e.g. I attempt to create a new repository via the web frontend, and see this is in the log file: ``` 2017/02/08 03:09:22 [T] action.newRepoAction: porjo/iantest2 2017/02/08 03:09:22 [...routers/repo/repo.go:103 handleCreateError()] [E] CreatePost: initRepository: InitRepository: fork/exec /usr/bin/git: cannot allocate memory [Macaron] 2017-02-08 03:09:22: Completed /repo/create 500 Internal Server Error in 5.075568ms 2017/02/08 03:09:22 [D] Template: status/500 ``` Top shows Gitea consuming in excess of 400MB! ``` top - 03:25:49 up 35 min, 2 users, load average: 0.00, 0.01, 0.05 Tasks: 110 total, 2 running, 108 sleeping, 0 stopped, 0 zombie %Cpu(s): 0.0 us, 0.0 sy, 0.0 ni,100.0 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st KiB Mem : 1015348 total, 210440 free, 520656 used, 284252 buff/cache KiB Swap: 0 total, 0 free, 0 used. 330864 avail Mem PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 2292 root 20 0 831856 449520 10332 S 0.0 44.3 0:01.19 gitea ``` I can understand why it might get upset about the initial push, but I would expect it to fail more gracefully. Why would it a) continue to consume so much memory b) not be able to allocate more memory for a simple operation (create repo) when there is still 210MB free!? I've stopped and started Gitea and it has returned to normal. Attempting to push the same repo again causes the same issue.
GiteaMirror added the issue/duplicate label 2025-11-02 03:18:48 -06:00
Author
Owner

@lunny commented on GitHub (Feb 8, 2017):

please discuss in #218.

@lunny commented on GitHub (Feb 8, 2017): please discuss in #218.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#327