[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mercurial
Subject:    Re: hg is killing my ram
From:       Matt Mackall <mpm () selenic ! com>
Date:       2012-03-26 16:36:32
Message-ID: 1332779792.6463.240.camel () calx
[Download RAW message or body]

On Mon, 2012-03-26 at 20:31 +1300, Ryan Brown wrote:
> Not sure how this should be properly configured, but I'm running hg
> 2.1.1 on Ubuntu, which is running hg serve and
> 
> /usr/local/bin/hg serve -6 -p80 -d
> 
> I have a bash script running every min...
> */1 * * * * sh /etc/hg-update.sh
> 
> #!/bin/bash
> cd /home/hg/hg-repo
> /usr/local/bin/hg pull
> /usr/local/bin/hg update
> sleep 12
> /usr/local/bin/hg pull
> /usr/local/bin/hg update
> sleep 12
> /usr/local/bin/hg pull
> /usr/local/bin/hg update
> sleep 12
> /usr/local/bin/hg pull
> /usr/local/bin/hg update
> sleep 12

This is an excellent recipe for crashing a box indeed, with or without
hg. Cron will happily start up another job whether or not the last one
has finished, so if something goes wrong, processes will quickly pile up
like box cars in a train wreck (of an infinitely long train with the
engine at the back).

Here for instance, if something takes the repository write lock but
fails to release it at 5pm on Monday, the box will surely be dead by 8am
Tuesday, having tried to run 54000 copies of hg (and bash and possibly
sendmail!) simultaneously. Similar problems if you hit a network outage.

It's much better to write this as a background script with a loop than
an every-minute cron job, as it will never create a machine-crashing
pile-up.

> If I leave this script, eventually it kills the box.. is there a
> better way of doing this? because hg saps the ram fast. Not sure if
> its the pulls and updates or web interface, but it leaks.

Please report -which- process is leaking with top, ps, smem[1] or
similar. Or whether you've got thousands of hg processes running (more
likely) by checking pstree.

[1] http://www.selenic.com/smem/

-- 
Mathematics is the supreme nostalgia of our time.


_______________________________________________
Mercurial mailing list
Mercurial@selenic.com
http://selenic.com/mailman/listinfo/mercurial
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic