mercurialapache2tortoisehg

Cannot push into Mercurial, End of script output before headers: hgweb.cgi, TortoiseHg command returned code 255


Mercurial was working fine but after a few pushes it starts returning error. I am using TortoiseHg and the log returns

command returned code 255

When I check the log from Apache, it mentions that hgweb.cgi is the problem

I can see the Mercurial repos on the web browser.

I'm running a Linode server and using Apache2 to host Mercurial.

I tried making every file in /var/hg executable by every user

sudo chmod -R a+rx /var/hg

I tried giving the script itself executable permission.

chmod +x hgweb.cgi

I tried running chown for Apache on the whole repos and it still not work

chown www-data -R /var/hg

I tried executing the .cgi file itself to see if there's any problem, but it terminates exactly the same way as Mercurial from my local Ubuntu server (which is working flawlessly).


Solution

  • I might have found the problem. My system has 1GB of RAM and OOM was killing it.

    In my frustration, I switched to nginx and did a reverse proxy. I ran it with a systemd service and collected logs from it with journalctl -u nameofyourmercurialservice

    Pushing a 400mb file results in OOM killer kicking in. I subsequently upgraded my system to 4GB and it worked.