From 054546a9f7dda8e6877550c46eb258c623e67de6 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 1 Oct 2009 16:55:58 +0000 Subject: Fix QPID-2086 - problem with read-credit. Also cleaned up the cluster test scripts. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@820717 13f79535-47bb-0310-9956-ffa450edef68 --- cpp/src/qpid/sys/AsynchIOHandler.cpp | 7 +++++++ cpp/src/tests/ais_check | 6 ------ cpp/src/tests/cluster.mk | 5 ++++- cpp/src/tests/cluster_read_credit | 27 +++++++++++++++++++++++++++ cpp/src/tests/clustered_replication_test | 20 +------------------- cpp/src/tests/federated_cluster_test | 20 +------------------- cpp/src/tests/run_cluster_test | 26 ++++++++++++++++++++++++++ cpp/src/tests/run_failover_soak | 24 +----------------------- cpp/src/tests/start_cluster | 9 +++------ 9 files changed, 70 insertions(+), 74 deletions(-) create mode 100755 cpp/src/tests/cluster_read_credit create mode 100755 cpp/src/tests/run_cluster_test (limited to 'cpp/src') diff --git a/cpp/src/qpid/sys/AsynchIOHandler.cpp b/cpp/src/qpid/sys/AsynchIOHandler.cpp index ae41eacfc3..eb0f213547 100644 --- a/cpp/src/qpid/sys/AsynchIOHandler.cpp +++ b/cpp/src/qpid/sys/AsynchIOHandler.cpp @@ -110,6 +110,13 @@ void AsynchIOHandler::readbuff(AsynchIO& , AsynchIO::BufferBase* buff) { // Check here for read credit if (readCredit.get() != InfiniteCredit) { + if (readCredit.get() == 0) { + // FIXME aconway 2009-10-01: Workaround to avoid "false wakeups". + // readbuff is sometimes called with no credit. + // This should be fixed somewhere else to avoid such calls. + aio->unread(buff); + return; + } // TODO In theory should be able to use an atomic operation before taking the lock // but in practice there seems to be an unexplained race in that case ScopedLock l(creditLock); diff --git a/cpp/src/tests/ais_check b/cpp/src/tests/ais_check index 79862d7439..d76c518808 100755 --- a/cpp/src/tests/ais_check +++ b/cpp/src/tests/ais_check @@ -47,9 +47,3 @@ with_ais_group() { id -nG | grep '\' >/dev/null || { echo "You are not a member of the ais group."; exit 1; } echo $* | newgrp ais } - -# Run the tests -srcdir=`dirname $0` -with_ais_group $srcdir/run_test ./cluster_test || ERROR=1 -exit $ERROR - diff --git a/cpp/src/tests/cluster.mk b/cpp/src/tests/cluster.mk index 05e18ab9eb..bdec10ebb0 100644 --- a/cpp/src/tests/cluster.mk +++ b/cpp/src/tests/cluster.mk @@ -30,7 +30,8 @@ if HAVE_LIBCPG # ais_check checks pre-requisites for cluster tests and runs them if ok. TESTS += \ - ais_check \ + run_cluster_test \ + cluster_read_credit \ test_watchdog \ run_cluster_tests \ federated_cluster_test \ @@ -38,6 +39,8 @@ TESTS += \ EXTRA_DIST += \ ais_check \ + run_cluster_test \ + cluster_read_credit \ test_watchdog \ start_cluster \ stop_cluster \ diff --git a/cpp/src/tests/cluster_read_credit b/cpp/src/tests/cluster_read_credit new file mode 100755 index 0000000000..370d4098c5 --- /dev/null +++ b/cpp/src/tests/cluster_read_credit @@ -0,0 +1,27 @@ +#!/bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# Regression test for http://issues.apache.org/jira/browse/QPID-2086 + +srcdir=`dirname $0` +. $srcdir/ais_check +$srcdir/start_cluster 1 --cluster-read-max=2 || exit 1 +trap $srcdir/stop_cluster EXIT +seq 1 10000 | ./sender --port `cat cluster.ports` --routing-key no-such-queue diff --git a/cpp/src/tests/clustered_replication_test b/cpp/src/tests/clustered_replication_test index 4713f4b3f9..4dcd113c47 100755 --- a/cpp/src/tests/clustered_replication_test +++ b/cpp/src/tests/clustered_replication_test @@ -55,25 +55,7 @@ stop_brokers() { } if test -d $PYTHON_DIR; then - id -nG | grep '\' >/dev/null || \ - NOGROUP="You are not a member of the ais group." - ps -u root | grep 'aisexec\|corosync' >/dev/null || \ - NOAISEXEC="The aisexec or corosync daemon is not running as root" - - if test -n "$NOGROUP" -o -n "$NOAISEXEC"; then - cat <' >/dev/null || \ - NOGROUP="You are not a member of the ais group." - ps -u root | grep 'aisexec\|corosync' >/dev/null || \ - NOAISEXEC="The aisexec or corosync daemon is not running as root" - - if test -n "$NOGROUP" -o -n "$NOAISEXEC"; then - cat <' >/dev/null || \ - NOGROUP="The ais group is not your primary group." -ps -u root | grep 'aisexec\|corosync' >/dev/null || \ - NOAISEXEC="The aisexec/corosync daemon is not running as root" - -if test -n "$NOGROUP" -o -n "$NOAISEXEC"; then - cat <' >/dev/null || { echo "You are not a member of the ais group." 1>&2; exit 1; } - echo $* | newgrp ais -} +. `dirname $0`/ais_check rm -f cluster*.log cluster.ports qpidd.port SIZE=${1:-3}; shift CLUSTER=`pwd` # Cluster name=pwd, avoid clashes. -OPTS="-d --no-module-dir --load-module ../.libs/cluster.so --cluster-name=$CLUSTER --auth=no $@" +OPTS="-d --no-module-dir --load-module ../.libs/cluster.so --cluster-name=$CLUSTER --auth=no --log-enable notice+ --log-enable debug+:cluster $@" for (( i=0; i> cluster.ports done -- cgit v1.2.1