|
From: | Timothy Brownawell |
Subject: | Re: [Monotone-devel] race condition on mtn automate stdio startup |
Date: | Fri, 25 Dec 2009 12:28:43 -0600 |
User-agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 |
On 12/18/2009 3:03 AM, Stephen Leake wrote:
I've just run across a race condition in mtn automate stdio. During the startup of the command, it checks for various error conditions, such as having a database specified. This can fail if the user is not actually in a workspace: bash-3.00$ mtn automate stdio mtn: misuse: no database specified On the other hand, if there are no errors, there is no output; the process is waiting for the next user command: bash-3.00$ cd gpm bash-3.00$ mtn automate stdio (killed with C-c) This is race condition; my Emacs front-end has to wait for "a while" to tell if the mtn process got started ok, before sending the first command.
The mtn process could also be hit by the OOM killer at any time after startup, or segfault or something.
I have not looked into possible fixes for this. Perhaps with the new out-of-band facility, there could be a "ready for first command" message at startup?
The code that sends commands to the stdio process, needs to remember the last command that it sent until it gets the end packet. Then it can retire that command and return the output; if the process exits without sending the end packet then it needs to be restarted and have the last command sent again (up to some limit, in case of non-transient errors).
[Prev in Thread] | Current Thread | [Next in Thread] |