NullPointerException on sending initial presence, involves privacy lists

a little involved, so bear with me. we’'re running wildfire 2.6.2 and seeing a NullPointerException in the server logs when certain users log in and send their initial presence. the exception is caught by the server and logged in PresenceUpdateHandler.process(PresenceUpdateHandler.java:141).

as far as i can tell, 2 conditions must be met to make this error happen:

  1. the client must create a non-empty privacy list and make it active (i put 1 entry in with a made up jid and type=’‘allow’’)

  2. there must be a pending subscription request directed at the client, sent while the client was unavailable

i’'ll give a concrete example to clarify. suppose i have 2 accounts, test1 and test2. test2 sends a subscription request to test1 while test1 is unavailable. test1 creates a non-empty privacy list, makes it active, and then becomes available. wildfire should throw the exception i mentioned above.

when this exception occurs, i do not receive any indication from the server that something has gone wrong. the behavior that led me to look in the logs in the first place was that the server failed to deliver presence stanzas to the client for some (but not all) of the user’'s contacts who were online at the time.

has anybody seen anything similar to this? i can provide more details if necessary

Hey Matt,

Could you post the complete stack trace for the error that appeared in your log file?

Thanks,

Alex

i don’'t see a stack trace in the error / warn / info / debug logs. the exception is caught by wildfire, which prints the following:

2006.06.30 11:06:21 org.jivesoftware.wildfire.handler.PresenceUpdateHandler.process(PresenceUpdateHa ndler.java:141) Internal server error. Triggered by packet:

java.lang.NullPointerException

that’‘s it, there’'s no stack trace after that last line. we are right now working on using a debugger to get a stack trace, until then this is the best info i have about the context

ok, running wildfire under a debugger yielded the following information.

stack trace is:

PrivacyItem.verifyJID(JID, Roster) line: 157

PrivacyItem.matchesPacketSenderCondition(Packet, Roster) line: 144

PrivacyItem.matchesCondition(Packet, Roster, JID) line: 126

PrivacyList.shouldBlockPacket(Packet) line: 101

ClientSession.shouldBlockPacket(Packet) line: 739

ClientSession.process(Packet) line: 745

PresenceUpdateHandler.initSession(ClientSession) line: 199

PresenceUpdateHandler.process(Packet) line: 100

PresenceUpdateHandler.process(Presence) line: 153

PresenceRouter.handle(Presence) line: 92

PresenceRouter.route(Presence) line: 61

PacketRouter.route(Presence) line: 73

ClientSocketReader(SocketReader).processPresence(Presence) line: 445

ClientSocketReader.processPresence(Presence) line: 56

ClientSocketReader(SocketReader).readStream() line: 242

ClientSocketReader(SocketReader).run() line: 119

Thread.run() line: 595

the source line in question is:

return jid.equals(jidValue);

jid is null, and jidValue is not null. the Roster argument to verifyJID is also null. the Packet that is being processed appears to be the subscription request that was sent to my account while i was offline.

Hey Matt,

Thanks for the bug report. The problem has been fixed so you can try again using the next nightly build. BTW, the problem was not only a NPE but there was also a bad filtering logic that was fixed.

Thanks,

– Gato

we got the nightly build of wildfire 3 from 07/03 and are still seeing the NullPointerException under these conditions. it’'s still being caught and logged at PresenceUpdateHandler.java:141

Message was edited by: mphears

Did you have the full stack trace for this exception, this would be helpful in diagnosing this issue?

java.lang.NullPointerException

at org.jivesoftware.wildfire.privacy.PrivacyItem.verifyJID(PrivacyItem.java:163)

at org.jivesoftware.wildfire.privacy.PrivacyItem.matchesPacketSenderCondition(Priv acyItem.java:149)

at org.jivesoftware.wildfire.privacy.PrivacyItem.matchesCondition(PrivacyItem.java :127)

at org.jivesoftware.wildfire.privacy.PrivacyList.shouldBlockPacket(PrivacyList.jav a:102)

at org.jivesoftware.wildfire.ClientSession.shouldBlockPacket(ClientSession.java:73 2)

at org.jivesoftware.wildfire.ClientSession.process(ClientSession.java:743)

at org.jivesoftware.wildfire.handler.PresenceUpdateHandler.initSession(PresenceUpd ateHandler.java:202)

at org.jivesoftware.wildfire.handler.PresenceUpdateHandler.process(PresenceUpdateH andler.java:100)

at org.jivesoftware.wildfire.handler.PresenceUpdateHandler.process(PresenceUpdateH andler.java:153)

at org.jivesoftware.wildfire.PresenceRouter.handle(PresenceRouter.java:92)

at org.jivesoftware.wildfire.PresenceRouter.route(PresenceRouter.java:61)

at org.jivesoftware.wildfire.spi.PacketRouterImpl.route(PacketRouterImpl.java:75)

at org.jivesoftware.wildfire.net.SocketReader.processPresence(SocketReader.java:29 6)

at org.jivesoftware.wildfire.net.ClientSocketReader.processPresence(ClientSocketRe ader.java:57)

at org.jivesoftware.wildfire.net.SocketReader.process(SocketReader.java:191)

at org.jivesoftware.wildfire.net.BlockingReadingMode.readStream(BlockingReadingMod e.java:156)

at org.jivesoftware.wildfire.net.BlockingReadingMode.run(BlockingReadingMode.java: 62)

at org.jivesoftware.wildfire.net.SocketReader.run(SocketReader.java:123)

at java.lang.Thread.run(Thread.java:595)

Try again using the next nightly build. Let us know how it goes.

Thanks,

– Gato

this problem appears to be fixed (i tested against the 07/07 build). thanks for your help