This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project iwhd.git.
The branch, master has been updated
via f74043a7e17d49b1f27e166d88ad8d09e9aafd2a (commit)
via b992b5231f12c76a9c33e9cd777a9e1863489d00 (commit)
from 39c17c133e63a5c9b339da577a09e0a77babcf9b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://repo.or.cz/w/iwhd.git/commit/f74043a7e17d49b1f27e166d88ad8d09e9aafd2a
commit f74043a7e17d49b1f27e166d88ad8d09e9aafd2a
Author: Pete Zaitcev <zaitcev(a)yahoo.com>
Date: Fri Oct 22 15:32:56 2010 -0600
Bump testing timeouts
I have a slow laptop that needs this. Lots of disk activity when testing,
looks like Mongo does not like ext3 much, at least on Fedora 15.
Note that it's preferable for the framework timeout to be greater than
the autostart's own timeout. This way if autostart times out, it kills
mongo that it started, and usually succeeds. But if we let framework
kill things, mongo sometimes escapes.
Also it's weird, but basic usually succeeds quickly enough, so no bump
there - only bump auto and replication tests.
diff --git a/auto.c b/auto.c
index c385521..b428bce 100644
--- a/auto.c
+++ b/auto.c
@@ -183,7 +183,7 @@ auto_wait_mongod(void)
rc = auto_test_mongod();
if (rc == 0)
break;
- if (time(NULL) >= start_time + 5) {
+ if (time(NULL) >= start_time + 20) {
error(0, 0, "failed to verify mongod using port %s",
auto_arg_port);
return -1;
diff --git a/t/auto b/t/auto
index 86efade..dee4c4e 100644
--- a/t/auto
+++ b/t/auto
@@ -22,11 +22,11 @@ iwhd -v -p $port -a &
iwhd_pid=$!
cleanup_() { kill $iwhd_pid; }
-# Wait for up to 3 seconds for mongod to begin listening.
-wait_for .1 30 'mongo localhost:$m_port < /dev/null' +# Wait for up to 10
seconds for mongod to begin listening.
+wait_for .1 100 'mongo localhost:$m_port < /dev/null' || framework_failure_
mongod failed to start
-# Wait for up to 3 seconds for iwhd to begin listening on $port.
-wait_for .1 30 "curl -s
http://localhost:$port" +# Wait for up to 20 seconds
for iwhd to begin listening on $port.
+wait_for .1 200 "curl -s
http://localhost:$port" || framework_failure_ iwhd
failed to start
mongo_pid=$(cat mongo.pid)
diff --git a/t/replication b/t/replication
index fc645b8..74423f2 100644
--- a/t/replication
+++ b/t/replication
@@ -18,8 +18,8 @@ mongod --port $m_port --pidfilepath mongod/pid --dbpath mongod >
mongod.log 2>&1
mongo_pid=$!
cleanup_() { kill -9 $mongo_pid; }
-# Wait for up to 3 seconds for mongod to begin listening.
-wait_for .1 30 'mongo localhost:$m_port < /dev/null' +# Wait for up to 12
seconds for mongod to begin listening.
+wait_for .1 120 'mongo localhost:$m_port < /dev/null' || framework_failure_
mongod failed to start
cat > iwhd_u.cfg << EOF
http://repo.or.cz/w/iwhd.git/commit/b992b5231f12c76a9c33e9cd777a9e1863489d00
commit b992b5231f12c76a9c33e9cd777a9e1863489d00
Author: Pete Zaitcev <zaitcev(a)yahoo.com>
Date: Fri Oct 22 15:32:03 2010 -0600
Lock auto.c to IPv4
As it turned out Mongo manages to listen on IPv4 only even if the
system supports IPv6. The autostart tries to connect over IPv6,
depending which address is returned first, and then fails.
The fix is simply to use IPv4 always, at least for loopback.
diff --git a/auto.c b/auto.c
index 6311f41..c385521 100644
--- a/auto.c
+++ b/auto.c
@@ -21,6 +21,7 @@
#include "iwh.h"
#include "state_defs.h"
+static int auto_db_port;
static char auto_arg_port[10];
static char *auto_arg_mongod[] = {
@@ -132,84 +133,34 @@ auto_spawn (const char *prog, char *argv[])
return pid;
}
-/*
- * The server_node and node_resolve are taken verbatim from wait-for-listen.
- * Is this time to factor?
- */
-#define ADDRSIZE 40
-
-struct server_node {
- unsigned alen;
- union {
- struct sockaddr addr;
- unsigned char x[ADDRSIZE];
- } a;
-};
-
-static int
-node_resolve(struct server_node *sn,
- const char *hostname, const char *portstr)
-{
- struct addrinfo hints;
- struct addrinfo *res, *res0;
- int rc;
-
- memset(&hints, 0, sizeof(struct addrinfo));
- hints.ai_family = PF_UNSPEC;
- hints.ai_socktype = SOCK_DGRAM;
-
- rc = getaddrinfo(hostname, portstr, &hints, &res0);
- if (rc) {
- error(0, 0, "getaddrinfo(%s:%s) failed: %s",
- hostname, portstr, gai_strerror(rc));
- return -1;
- }
-
- for (res = res0; res; res = res->ai_next) {
- if (res->ai_family != AF_INET && res->ai_family != AF_INET6)
- continue;
-
- if (res->ai_addrlen > ADDRSIZE) /* should not happen */
- continue;
-
- memcpy(&sn->a.addr, res->ai_addr, res->ai_addrlen);
- sn->alen = res->ai_addrlen;
-
- freeaddrinfo(res0);
- return 0;
- }
-
- freeaddrinfo(res0);
- return -1;
-}
-
static int
auto_test_mongod(void)
{
- struct server_node snode, *sn = &snode;
+ union {
+ struct sockaddr_in a4;
+ struct sockaddr a;
+ } addr;
int sfd;
int rc;
- memset(sn, 0, sizeof(struct server_node));
- if (node_resolve(sn, AUTO_HOST, auto_arg_port) != 0) {
- /*
- * Most likely nothing else would work anyway. So abend.
- */
- error(0, 0, "unable to resolve host %s port %s",
- AUTO_HOST, auto_arg_port);
- return -1;
- }
+ /*
+ * We hardcode IPv4 because Mongo often listens on IPv4 only.
+ */
+ memset(&addr, 0, sizeof(addr));
+ addr.a4.sin_family = AF_INET;
+ addr.a4.sin_port = htons(auto_db_port);
+ addr.a4.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- DPRINTF("trying to connect to mongod (host %s port %s) ...n",
- AUTO_HOST, auto_arg_port);
+ DPRINTF("trying to connect to mongod (host 127.0.0.1 port %u) ...n",
+ auto_db_port);
- sfd = socket(sn->a.addr.sa_family, SOCK_STREAM, 0);
+ sfd = socket(addr.a.sa_family, SOCK_STREAM, 0);
if (sfd < 0) {
error(0, errno, "socket");
return -1;
}
- rc = connect(sfd, &sn->a.addr, sn->alen);
+ rc = connect(sfd, &addr.a, sizeof(addr.a4));
if (rc != 0) {
DPRINTF("connect: %sn", strerror(errno));
close(sfd);
@@ -296,6 +247,7 @@ auto_start (int dbport)
char **earg;
int pid;
+ auto_db_port = dbport;
snprintf(auto_arg_port, sizeof(auto_arg_port), "%u", dbport);
if (auto_prepare_area() < 0)
-----------------------------------------------------------------------
Summary of changes:
auto.c | 84 ++++++++++++--------------------------------------------
t/auto | 8 +++---
t/replication | 4 +-
3 files changed, 24 insertions(+), 72 deletions(-)
repo.or.cz automatic notification. Contact project admin jim(a)meyering.net
if you want to unsubscribe, or site admin admin(a)repo.or.cz if you receive
no reply.
--
iwhd.git ("image warehouse daemon")