Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Null pointer exception caused by accessing a null token returned from TokenStore in java mqtt client library

Hi,

I'm out of the office until Friday, I'll take a closer look then.  Can you try the current 1.0.0 version?  It's available on this page as a jar - https://projects.eclipse.org/projects/technology.paho/downloads.

Thanks

Ian

On 10/29/2014 04:10 PM, Рангел Иванов wrote:
I'm using the 0.4.0 version of the java mqtt client library in an android application.

Here's what happens (QoS=2 messages only):

1. CommsReceiver thread reads  ack message (PUBCOMP)  from network

2.  Then it retrieves the token for the specified message from the token store and calls ClientState.notifyReceivedAck() passing the message received from network.

3. Then ClientState.notifyReceivedAck()  tries to retrieve the token from the token store  but the token is null causing a NPE when ClientState.notifyResult() method tries to call Token.internalTok.markComplete() on the NULL token.


Looking at the logs of the mqtt server broker  i see that a PUBREC message was published to the client twice after which the broker send two PUBCOMP messages with same message id (after the client has sent PUBREL as specified in the mqtt specification).

I think this may be a threading issue in the mqtt java client library resulting of another thread removing the message from the token store after the  CommsReceiver  has read the message from the TokenStore ? Or is that happening because the broker sends two messages with the same id ?

I'ts really hard to reproduce this NPE (it happens something like once in 20 reconnects). I'm causing it by repeatedly publishing messages to  a topic and then turning off internet connectivity on the device and then turning it back on again.  

I've also tried the 0.9.0 version of the client library but the problem remains.

Do you have any idea what maybe causing this and do you think my conclusions are right ?  


_______________________________________________
paho-dev mailing list
paho-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/paho-dev

-- 
Ian Craggs                          
icraggs@xxxxxxxxxx                 IBM United Kingdom
Paho Project Lead; Committer on Mosquitto


Back to the top