Re: [PATCH] test/smtp-dummy: add --background option for backgrounding after listen(2)

Subject: Re: [PATCH] test/smtp-dummy: add --background option for backgrounding after listen(2)

Date: Mon, 12 Dec 2011 11:18:00 -0500

To: Tomi Ollila

Cc: notmuch@notmuchmail.org

From: Austin Clements


Quoth Tomi Ollila on Dec 12 at  4:57 pm:
> To avoid the possibility that smtp-dummy doesn't have chance to listen
> its bound socket until something tries to send message to it this
> option can be used for caller to wait until socket is already listening
> for a connection.
> ---
> 
> When test_require_external_prereq() is changed to use associative
> array to check whether prereq is missing bash script is often 
> so fast that it already waiting for smtp-dummy to exit until
> socket is listening. i.e sending QUIT to 127.0.0.1:25025 fails
> since there is no listener. (fork(2) & execve(2) count goes to zero
> in test_require_external_prereq (from 3 fork()s, 2 execve()s).

Perhaps smtp-dummy should always work this way?  There's a race even
in the working case, since Emacs could try to connect to the
smtp-dummy before it's listening (perhaps Emacs retries in that case,
but I couldn't find any code to do so).

How are you going to wait on the dummy, since you don't know its PID
any more?

Thread: