Hide Forgot
Description of problem: Qpid java client crashes with NPE at org.apache.qpid.client.AMQAnyDestination.getTopicName(AMQAnyDestination.java:75) using bug 667771 test program: Exception occurred: java.lang.NullPointerException java.lang.NullPointerException at org.apache.qpid.client.AMQAnyDestination.getTopicName(AMQAnyDestination.java:75) at org.apache.qpid.client.AMQSession.createDurableSubscriber(AMQSession.java:1065) at org.apache.qpid.client.AMQSession.createDurableSubscriber(AMQSession.java:1039) at DurableReceiver.main(DurableReceiver.java:24) The issus seen on both RHEL 5.6 / 6.1s5 i[36]86 / x86_64. Version-Release number of selected component (if applicable): python-qpid-0.10-1.el5.noarch python-qpid-qmf-0.10-6.el5.x86_64 qpid-cpp-client-0.10-4.el5.x86_64 qpid-cpp-client-devel-0.10-4.el5.x86_64 qpid-cpp-client-devel-docs-0.10-4.el5.x86_64 qpid-cpp-client-rdma-0.10-4.el5.x86_64 qpid-cpp-client-ssl-0.10-4.el5.x86_64 qpid-cpp-mrg-debuginfo-0.10-4.el5.x86_64 qpid-cpp-server-0.10-4.el5.x86_64 qpid-cpp-server-cluster-0.10-4.el5.x86_64 qpid-cpp-server-devel-0.10-4.el5.x86_64 qpid-cpp-server-rdma-0.10-4.el5.x86_64 qpid-cpp-server-ssl-0.10-4.el5.x86_64 qpid-cpp-server-store-0.10-4.el5.x86_64 qpid-cpp-server-xml-0.10-4.el5.x86_64 qpid-dotnet-0.4.738274-2.el5.x86_64 qpid-java-client-0.10-4.el5.noarch qpid-java-common-0.10-4.el5.noarch qpid-java-example-0.10-4.el5.noarch qpid-qmf-0.10-6.el5.x86_64 qpid-qmf-debuginfo-0.10-6.el5.x86_64 qpid-qmf-devel-0.10-6.el5.x86_64 qpid-tests-0.10-1.el5.noarch qpid-tools-0.10-4.el5.noarch rh-qpid-cpp-tests-0.10-4.el5.x86_64 ruby-qpid-qmf-0.10-6.el5.x86_64 sesame-0.10-1.el5.x86_64 sesame-debuginfo-0.10-1.el5.x86_64 How reproducible: 100% Steps to Reproduce: 1. start broker 2. get https://bugzilla.redhat.com/attachment.cgi?id=472108 3. jrunner DurableReceiver (see below) Actual results: Qpid client crashes. Expected results: Qpid client should not crash. Additional info: function jrunner () { local err_cnt=0 local CLASS_NAME="DurableReceiver" local FILE_NAME="${CLASS_NAME}.java" ls -lA ${FILE_NAME} || return 1 local QPID_DEPS=`find /usr/share/java/qpid-deps/*.jar | tr '\n' ":"` local QPID_JARS=`find /usr/share/java -name 'qpid-client*.jar' -or -name 'qpid-common*.jar' | tr '\n' ":"` local LOG4J="/usr/share/java/log4j.jar" local QPID_CLASSPATH=$QPID_DEPS$LOG4J:$QPID_JARS javac -cp "$QPID_DEPS$LOG4J:$QPID_JARS" ${FILE_NAME} || let "err_cnt++" java -cp "$QPID_DEPS$LOG4J:$QPID_JARS" ${CLASS_NAME} || let "err_cnt++" return ${err_cnt} } [root@mrg-qe-07 bz667771]# jrunner DurableReceiver -rw-r--r--. 1 root root 2010 May 5 02:41 DurableReceiver.java log4j:WARN No appenders could be found for logger (org.apache.qpid.jndi.PropertiesFileInitialContextFactory). log4j:WARN Please initialize the log4j system properly. Exception occurred: java.lang.NullPointerException java.lang.NullPointerException at org.apache.qpid.client.AMQAnyDestination.getTopicName(AMQAnyDestination.java:75) at org.apache.qpid.client.AMQSession.createDurableSubscriber(AMQSession.java:1065) at org.apache.qpid.client.AMQSession.createDurableSubscriber(AMQSession.java:1039) at DurableReceiver.main(DurableReceiver.java:24)
This is caused due to the address not being resolved properly. All though this is not a blocker, we probably needs to fix this. I will be posting a patch upstream shortly for review.
This issue is tracked in upstream via QPID-3254 This went through the review process in upstream Qpid project. See https://reviews.apache.org/r/706/ Following is a list of commits that went in for this bug. 1. http://svn.apache.org/viewvc?view=revision&revision=1102002 This commit added logic to resolve an address string to ensure we have enough information to handle corner cases like addresses without subjects. It also adds null checks for getRoutingKey() method and getTopicName() method in both AMQTopic and AMQAnyDestination classes, which causes the NPE mentioned in this bug. 2. http://svn.apache.org/viewvc?view=revision&revision=1102102 Added logic to ensure only Topics are used in creating durable subs to avoid any unnecessary complications arising as a result of using named Queues. It also marks the private queue being used as durable even if marked otherwise in the address string. 3. http://svn.apache.org/viewvc?rev=1103884&view=rev Changed the default value for routing key based on a review comment by Robert Godfrey.
The issue has been corrected on qpid-java-0.10-6, tested on RHEL 5.6/6.1 i[36]86 / x86_64, no more NPE seen. -> VERIFIED
Thanks Frantisek for the quick work. The fixes were ported to the release branch at. http://mrg1.lab.bos.redhat.com/cgit/qpid.git/commit/?h=mrg_2.0.x&id=9e87f9c75779a3058dd27c5524ce9f85706f5321 http://mrg1.lab.bos.redhat.com/cgit/qpid.git/commit/?h=mrg_2.0.x&id=c65f5a3ae1713e7296d097d335b64befccd29651 http://mrg1.lab.bos.redhat.com/cgit/qpid.git/commit/?h=mrg_2.0.x&id=8a923a906baea478bbbc3eaf8d54ff0f03f68945