Push failing "The remote end hung up unexpectedly"

Gogs: 0.9.13
System: Windows 2003 SP2
Database: MySQL Ver 14.14 Distrib 5.5.48, for Win32 (x86)

When I try to push a fairly large repo to Gogs over HTTP I get The remote end hung up unexpectedly

The output from git push origin master is

Counting objects: 47416, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (14975/14975), done.
Writing objects: 100% (47416/47416), 138.37 MiB | 259.88 MiB/s, done.
Total 47416 (delta 31821), reused 46707 (delta 31398)
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 only output I get from gogs is in the http.log saying

[...routers/repo/http.go:380 serviceRpc()] [E] fail to serve RPC(receive-pack): exit status 128

When this takes place I see the gogs process spin up using 100% CPU and then stops when I get the error using just short of 500M of memory.

It works when I push using SSH but I’d like to get HTTP working since VisualStudio does not support git over SSH (yet).

I’ve tried the solutions mentioned in http://stackoverflow.com/a/6849424 by setting http.postBuffer to 1G but still the same error. I’ve also tried the things suggested in http://stackoverflow.com/a/30696906 but still nothing.

By looking into the golang docs I found [https://]golang.org/pkg/net/http/#MaxBytesReader but I have no idea if that is related to this and I have no experience with go so I thought I’d post a question here before I start tinkering around in the source.

Well… apparently I can only post 2 links so you’re going to have “unhack” the links if you want to visit them.

Hi, do you get same error if you push a small/new repository?

Sorry for the late reply. No small/new repos works fine.

Did a bit research I think it could be Windows-specific problem when large push with Git. Haven’t had a good solution yet… :sweat:

I get into the same issue, but it is cause by git post-recieve

when I using ng build, it happened.
when rm ng build , it is normal.

is it using too much resouce to cause exit?

below are the hook, I add

umask 002
export GIT_WORK_TREE=/mnt/app/project/project-sr-create
export GIT_DIR=${GIT_WORK_TREE}/.git

while read oldrev newrev ref
    if [ "$ref" = "refs/heads/master" ]; then 
        echo  'you are pushing to master'
        # git pull origin master
    if [ "$ref" = "refs/heads/ec2" ]; then 
    	echo 'updating dev branch'
        git pull gogs ec2
    	echo 'completed'
    	cd project-sr-create/web
    	npm install
        echo 'ng building start'
    	/usr/local/node/bin/ng build --base-href '/project-cache/project/' -c stg