-
1. Re: NPE when closing connection
jmachowinski Mar 15, 2006 10:55 AM (in response to jmachowinski)I forgot to say, we use JBoss 3.2.8.SP1 on SuSe Linux 9.3 (32Bit)
Okay, it took some hours, but now I have a TRACE trace ;-)
2006-03-15 13:30:31,035 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
2006-03-15 13:30:31,035 DEBUG [org.jboss.mq.il.uil2.SocketManager] End ReadTask.run
2006-03-15 13:30:31,035 DEBUG [org.jboss.mq.il.uil2.UILClientILService] Stopping
2006-03-15 13:30:31,038 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run
2006-03-15 13:30:31,052 ERROR [org.jboss.mq.il.uil2.SocketManager] Failed to handle: org.jboss.mq.il.uil2.msgs.CloseMsg13905452[msgType: m_connectionClosing,
msgID: -2118850601, error: null]
java.lang.NullPointerException
at org.jboss.mq.server.JMSDestinationManager.connectionClosing(JMSDestinationManager.java:509)
at org.jboss.mq.server.JMSServerInterceptorSupport.connectionClosing(JMSServerInterceptorSupport.java:128)
at org.jboss.mq.security.ServerSecurityInterceptor.connectionClosing(ServerSecurityInterceptor.java:77)
at org.jboss.mq.server.TracingInterceptor.connectionClosing(TracingInterceptor.java:193)
at org.jboss.mq.server.JMSServerInvoker.connectionClosing(JMSServerInvoker.java:128)
at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:126)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:396)
at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:392)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
at java.lang.Thread.run(Thread.java:534)
2006-03-15 13:30:31,060 DEBUG [org.jboss.mq.il.uil2.UILClientILService] Stopping
2006-03-15 13:30:31,062 DEBUG [org.jboss.mq.il.uil2.SocketManager] End WriteTask.run
Could this be some weired concurrency problem ?
While looking through the trace, I also noticed, that it is full of stacktraces like
2006-03-15 13:30:31,195 DEBUG [org.jboss.mq.il.uil2.SocketManager] Failed to handle: org.jboss.mq.il.uil2.msgs.CloseMsg28257914[msgType: m_connectionClosing,
msgID: -2118850538, error: null]
java.io.IOException: Client is not connected
at org.jboss.mq.il.uil2.SocketManager.internalSendMessage(SocketManager.java:265)
at org.jboss.mq.il.uil2.SocketManager.sendReply(SocketManager.java:239)
at org.jboss.mq.il.uil2.ServerSocketManagerHandler.handleMsg(ServerSocketManagerHandler.java:128)
at org.jboss.mq.il.uil2.SocketManager$ReadTask.handleMsg(SocketManager.java:396)
at org.jboss.mq.il.uil2.msgs.BaseMsg.run(BaseMsg.java:392)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
at java.lang.Thread.run(Thread.java:534)
is this normal ?
Thanks -
2. Re: NPE when closing connection
adrian.brock Mar 17, 2006 6:09 AM (in response to jmachowinski)I don't see how that is possible unless there is a bug in
ConcurrentReaderHashMap.
The message says you managed to get a null into the
SpyDestinations->JMSDestinations map
But ConcurrentReaderHashMap (which stores the map)
doesn't accept null in either the key or the value.public void connectionClosing(ConnectionToken dc) throws JMSException { if (dc == null) return; // Close it's ClientConsumer ClientConsumer cq = (ClientConsumer) clientConsumers.remove(dc); if (cq != null) cq.close(); //unregister its clientID if (dc.getClientID() != null) stateManager.removeLoggedOnClientId(dc.getClientID()); //Remove any temporary destinations the consumer may have created. Iterator i = destinations.entrySet().iterator(); while (i.hasNext()) { Map.Entry entry = (Map.Entry) i.next(); JMSDestination sq = (JMSDestination) entry.getValue(); ClientConsumer cc = sq.temporaryDestination; // NPE HERE (line 509) - sq comes from value side of ConcurrentReaderHashMap!!!! if (cc != null && dc.equals(cc.connectionToken)) { i.remove(); deleteTemporaryDestination(dc, sq); } } // Close the clientIL try { if (dc.clientIL != null) dc.clientIL.close(); } catch (Exception ex) { // We skipp warning, to often the client will allways // have gone when we get here //log.warn("Could not close clientIL: " +ex,ex); } }
-
3. Re: NPE when closing connection
genman Mar 17, 2006 11:21 PM (in response to jmachowinski)Couldn't Map.Entry change between iteration and use? Looking at the class, it's certainly possible:
Map m = new ConcurrentHashMap(); m.put("foo", "bar"); Iterator i = m.entrySet().iterator(); Map.Entry me = i.next(); m.removeKey("foo"); me.getValue(); // returns null
Not sure how getValue() should behave in these circumstances...
Looking at the source to "remove:"public Object remove(Object key) { /* Find the entry, then 1. Set value field to null, to force get() to retry 2. Rebuild the list without this entry. All entries following removed node can stay in list, but all preceeding ones need to be cloned. Traversals rely on this strategy to ensure that elements will not be repeated during iteration. */
Also, take a look at ConcurrentHashMap.putAll:public synchronized void putAll(Map t) { int n = t.size(); if (n == 0) return; // Expand enough to hold at least n elements without resizing. // We can only resize table by factor of two at a time. // It is faster to rehash with fewer elements, so do it now. while (n >= threshold) rehash(); for (Iterator it = t.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Map.Entry) it.next(); Object key = entry.getKey(); Object value = entry.getValue(); put(key, value); } }
Seems like doing a copy operation when a map is being concurrently modified might result in some NPEs.
Do I get a cookie? -
4. Re: NPE when closing connection
adrian.brock Mar 21, 2006 2:00 PM (in response to jmachowinski)Better than a cookie, a bug report:
http://jira.jboss.com/jira/browse/JBAS-2973 -
5. Re: NPE when closing connection
stnieman Mar 23, 2006 11:58 AM (in response to jmachowinski)I have seen this problem from 3.2.7 on.
http://www.jboss.com/index.html?module=bb&op=viewtopic&t=78957
So when is JBossAS-4.0.4.CR2 to be released? Can it be apply to 3.2.8 in a SP2???? -
6. Re: NPE when closing connection
starksm64 Mar 25, 2006 12:11 PM (in response to jmachowinski)When the 4.0.4.CR2 roadmap issues are resolved it will be released. There are no plans for a 3.2.8SP2 in the near future currently.
-
7. Re: NPE when closing connection
dfantham Apr 25, 2006 1:28 AM (in response to jmachowinski)"adrian@jboss.org" wrote:
Better than a cookie, a bug report:
http://jira.jboss.com/jira/browse/JBAS-2973
We are using Jboss 3.2.8 SP1 and are seeing these errors throughout the system when using JMS queues. Is there a workaround in the 3.2.8 system or something we can include into our beans to deal with this?