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

Austin Clements amdragon at MIT.EDU
Mon Dec 12 08:18:00 PST 2011


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?


More information about the notmuch mailing list