Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

axolotl: NoSessionException #593

Closed
jlguardi opened this issue Jan 28, 2015 · 10 comments
Closed

axolotl: NoSessionException #593

jlguardi opened this issue Jan 28, 2015 · 10 comments

Comments

@jlguardi
Copy link
Collaborator

After some hours of running with axolotl enabled, after keys transfer, I've recieved the following exception:

Traceback (most recent call last):
  File "run.py", line 54, in <module>
    stack.loop() #this is the program mainloop
  File "./yowsup/stacks/yowstack.py", line 57, in loop
    asyncore.loop(*args, **kwargs)
  File "/usr/lib/python2.7/asyncore.py", line 216, in loop
    poll_fun(timeout, map)
  File "/usr/lib/python2.7/asyncore.py", line 156, in poll
    read(obj)
  File "/usr/lib/python2.7/asyncore.py", line 87, in read
    obj.handle_error()
  File "/usr/lib/python2.7/asyncore.py", line 83, in read
    obj.handle_read_event()
  File "/usr/lib/python2.7/asyncore.py", line 449, in handle_read_event
    self.handle_read()
  File "./yowsup/layers/network/layer.py", line 48, in handle_read
    self.receive(data)
  File "./yowsup/layers/network/layer.py", line 55, in receive
    self.toUpper(data)
  File "./yowsup/layers/__init__.py", line 56, in toUpper
    self.__upper.receive(data)
  File "./yowsup/layers/stanzaregulator/layer.py", line 28, in receive
    self.processReceived()
  File "./yowsup/layers/stanzaregulator/layer.py", line 51, in processReceived
    self.processReceived()
  File "./yowsup/layers/stanzaregulator/layer.py", line 48, in processReceived
    self.toUpper(oneMessageData)
  File "./yowsup/layers/__init__.py", line 56, in toUpper
    self.__upper.receive(data)
  File "./yowsup/layers/auth/layer_crypt.py", line 63, in receive
    self.toUpper(payload)
  File "./yowsup/layers/__init__.py", line 56, in toUpper
    self.__upper.receive(data)
  File "./yowsup/layers/coder/layer.py", line 35, in receive
    self.toUpper(node)
  File "./yowsup/layers/__init__.py", line 56, in toUpper
    self.__upper.receive(data)
  File "./yowsup/layers/logger/layer.py", line 14, in receive
    self.toUpper(data)
  File "./yowsup/layers/__init__.py", line 56, in toUpper
    self.__upper.receive(data)
  File "./yowsup/layers/axolotl/layer.py", line 99, in receive
    self.onMessage(protocolTreeNode)
  File "./yowsup/layers/axolotl/layer.py", line 117, in onMessage
    self.handleEncMessage(protocolTreeNode)
  File "./yowsup/layers/axolotl/layer.py", line 175, in handleEncMessage
    self.handleWhisperMessage(node)
  File "./yowsup/layers/axolotl/layer.py", line 195, in handleWhisperMessage
    plaintext = sessionCipher.decryptMsg(whisperMessage)
  File "/usr/local/lib/python2.7/dist-packages/python_axolotl-0.1.1-py2.7.egg/axolotl/sessioncipher.py", line 65, in decryptMsg
    raise NoSessionException("No session for: %s, %s" % (self.recipientId, self.deviceId))
axolotl.nosessionexception.NoSessionException: No session for: 3xxxxxxxxxx, 1

I've restarted some times and I've working again my app but I don't really know what happened.

@tgalal
Copy link
Owner

tgalal commented Jan 28, 2015

did you at some point delete your axolotl.db and requested new keys ?

@jlguardi
Copy link
Collaborator Author

I think no. I mean, I was playing with keys in other lines but this one is in production and I think I just created keys and run my app.
No keys delete or modifications.

@tgalal
Copy link
Owner

tgalal commented Jan 28, 2015

the number you login with in production, is it the same you used outside production?

@jlguardi
Copy link
Collaborator Author

No, never.

@tgalal
Copy link
Owner

tgalal commented Jan 28, 2015

Alright, can you retry login for about another 6 times and then this error will go away because whatsapp will stop sending the message to you. And then send a message to this number from yowsup, this should then create the missing session, and hopefully fixes the problem.

@jlguardi
Copy link
Collaborator Author

If I start yowsup-cli, it fixes my problem. So I suppose it is because my application layer.py. So I think it isn't a yowsup error.
I will analyze and report anything.

@jlguardi
Copy link
Collaborator Author

After send a message with to encrypted destination, I receive sometimes the following sequence:

1.- send message to encrypted destination
2.- received message ack (so I will no resend)
3.- received and ack'd message

<receipt type="retry" from="3xxxxxxx@s.whatsapp.net" id="142xxxxx-1" t="1422xxxxx"
<retry count="1" t="1422xxxxx" id="142xxxx-1" v="1">
</retry>
<registration>
xxxx
HEX:xxxxx
</registration>
</receipt>

So my message is never received and I marked as sent.

What should I do?

@bmutinda
Copy link

I did some changes- try, except in some sections of yowsup(axolotl layer and protocol_message entity) and the issue was completely fixed.
Check my comment here #683

@aesedepece
Copy link
Contributor

This information could be valuable:

Party A: latest Yowsup 2 with Android Env 2.12.67, Axolotl enabled
Party B: Bq E5 FHD smartphone with WhatsApp official apk 2.12.84, Axolotl enabled

Keys are queried but returned key list is empty:

DEBUG:yowsup.layers.logger.layer:tx:
<iq to="s.whatsapp.net" xmlns="encrypt" type="get">
  <key>
    <user jid="(partyb)@s.whatsapp.net"></user>
  </key>
</iq>

DEBUG:yowsup.layers.logger.layer:rx:
<iq type="result" from="s.whatsapp.net">
  <list></list>
</iq>

As the key list is empty, we don't get any key and any incoming message from party B can't be deciphered and following exception is raised:

NoSessionException: No session for: (partyb), 1

Then party B uninstalls WhatsApp, installs a more recent version 2.12.94 and gets a new key.
Now I can perfectly fetch the new key and decipher incoming messages:

DEBUG:yowsup.layers.logger.layer:tx:
<iq to="s.whatsapp.net" xmlns="encrypt" type="get">
  <key>
    <user jid="(partyb)@s.whatsapp.net"></user>
  </key>
</iq>

DEBUG:yowsup.layers.logger.layer:rx:
<iq type="result" from="s.whatsapp.net">
  <list>
    <user jid="(partyb)@s.whatsapp.net">
      <registration>����</registration>
      <type></type>
      <identity>�������z�n$�bw����o�JMb�O(�k��y</identity>
      <skey>
        <id></id>
        <value>��F5q��vQ�b2�JE��d5;����1���6��Y</value>
        <signature>���ܹ�0=0>6�i�M���1u����e�)38���Lt1�;Y������ɲ��L���JDZ\��</signature>
      </skey>
      <key>
        <id>�{�</id>
        <value>�)���蠪�%�����<y�S��G���E���u</value>
      </key>
    </user>
  </list>
</iq>

Maybe some WhatsApp versions (i.e.: 2.12.84) fail to publish their keys?
What do you think, @tgalal?

@tgalal
Copy link
Owner

tgalal commented Jul 27, 2015

Please try code from develop branch

@tgalal tgalal closed this as completed in 6ebbbe2 Aug 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants