Thread safety

Mads Kiilerich mads at kiilerich.com
Wed Nov 6 13:46:01 CST 2013


How safe/unsafe do you think it is to run Mercurial in a multi threaded app?

Especially, how dangerous / efficient is it really to run hgweb multi 
threaded? Is it really necessary to run multiple "threads" as separate 
processes?

http://selenic.com/pipermail/mercurial/2009-May/026069.html says:
> - you can't have multiple threads working on the same objects
> (repository, dirstate, context, revlog)
> - there are a couple global variables such as encoding mode
>
> These shouldn't be much of an issue. For instance, you can create
> multiple repo objects pointing to the same repo on disk and they will
> use locking appropriately.
>
> However, there may be bugs lurking as this is definitely not the
> standard mode of operation.

Largefiles do horrible things such as monkey patching modules and 
classes on runtime. That is however only(?) at the command level and for 
operations touching the working directory. The server and store parts 
seems better.

Can anyone add more to how tread safe Mercurial is? Are you aware of 
other problems or have you tried it and found that there is no problems?

/Mads




More information about the Mercurial-devel mailing list