Comment 7 for bug 974617

Revision history for this message
Gary Poster (gary) wrote :

This still isn't quite addressed. I got another instance today (breaking our 12-run green streak!) http://pastebin.ubuntu.com/975858/ .

Right now, in the pgbouncer fixture, we are saying that we have finished with the "start" method as soon as there is a pgbouncer subprocess and we can poll it. There's no guarantee that this will mean that pgbouncer is actually "open for business". There might or might not be a guarantee that Launchpad is ready to recognize that pgbouncer has returned.

I think we should use the method Brad did initially (retrying the url) but just give it some more time. Let's keep the code in the bouncer's start method too--it's good. But let's re-add this (see https://code.launchpad.net/~bac/launchpad/bug-974617-2/+merge/103339), and increase the retry count to 10.

26 - # bouncer.start() can sometimes return before the service is actually
27 - # available for use. To be defensive, let's retry a few times. See
28 - # bug 974617.
29 - retries = 5
30 - for i in xrange(retries):
31 - try:
32 - urllib2.urlopen(url)
33 - except urllib2.HTTPError as e:
34 - if e.code != httplib.SERVICE_UNAVAILABLE:
35 - raise
36 - else:
37 - break
38 - time.sleep(0.5)
39 - else:
40 - raise TimeoutException(
41 - "bouncer did not come up after {} attempts.".format(retries))