I have a component that responds to Service Discovery requests. After a while, the stream disconnects and the server component reconnects. The stream is re-established, but as you can see in the logs below, the component stops responding.
I think the problem is with the eventRunner thread. It quits after the stream disconnects and is not restarted.
Is there a way to restart the eventRunner thread?
Correct behavior:
DEBUG RECV: /ns0:iq
DEBUG Info request from component.example.com
DEBUG SEND:
Behavior after the stream reconnects:
DEBUG RECV: /ns0:iq
Full logs below:
(msm)[root@host xmpp]# python service.py --debug
DEBUG Loaded Plugin (XEP-0030) Service Discovery
DEBUG Loaded Plugin (XEP-0009) Jabber-RPC
DEBUG Loaded Plugin (XEP-0199) XMPP Ping
DEBUG Connecting to xmpp.example.com:5275
DEBUG Loading event runner
DEBUG SEND:
DEBUG SEND: d0dae26cfb9af754a2152b8ded53ee556f3905c6
DEBUG RECV:
DEBUG XMPP connected
DEBUG RECV: /ns0:iq
DEBUG Info request from component.example.com
DEBUG SEND:
DEBUG SEND: /stream:stream
DEBUG Connecting to xmpp.example.com:5275
Traceback (most recent call last):
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 171, in _process
while self.run and self.readXML():
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 217, in readXML
for (event, xmlobj) in cElementTree.iterparse(self.filesocket, (b'end', b'start')):
File "", line 61, in iter
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/filesocket.py", line 14, in read
data = self._sock.recv(size)
AttributeError: 'NoneType' object has no attribute 'recv'
DEBUG SEND:
WARNING Failed to send
ERROR Disconnected. Socket Error.
Traceback (most recent call last):
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 245, in _sendThread
self.socket.send(data.encode('utf-8'))
File "/usr/local/lib/python2.6/socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
DEBUG SEND: /stream:stream
WARNING Failed to send /stream:stream
ERROR Disconnected. Socket Error.
Traceback (most recent call last):
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 245, in _sendThread
self.socket.send(data.encode('utf-8'))
File "/usr/local/lib/python2.6/socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
DEBUG Quitting eventRunner thread
DEBUG Connecting to xmpp.example.com:5275
DEBUG SEND:
DEBUG SEND: 61c82993e70ab4dd263ee962637ab8d5168732af
DEBUG RECV:
DEBUG RECV: /ns0:iq
DEBUG SEND: /stream:stream
I have a component that responds to Service Discovery requests. After a while, the stream disconnects and the server component reconnects. The stream is re-established, but as you can see in the logs below, the component stops responding.
I think the problem is with the eventRunner thread. It quits after the stream disconnects and is not restarted.
Is there a way to restart the eventRunner thread?
Correct behavior:
DEBUG RECV: /ns0:iq
DEBUG Info request from component.example.com
DEBUG SEND:
Behavior after the stream reconnects:
DEBUG RECV: /ns0:iq
Full logs below:
(msm)[root@host xmpp]# python service.py --debug DEBUG Loaded Plugin (XEP-0030) Service Discovery DEBUG Loaded Plugin (XEP-0009) Jabber-RPC DEBUG Loaded Plugin (XEP-0199) XMPP Ping DEBUG Connecting to xmpp.example.com:5275 DEBUG Loading event runner DEBUG SEND:
DEBUG SEND: d0dae26cfb9af754a2152b8ded53ee556f3905c6
DEBUG RECV:
DEBUG XMPP connected
DEBUG RECV: /ns0:iq
DEBUG Info request from component.example.com
DEBUG SEND:
DEBUG SEND: /stream:stream
DEBUG Connecting to xmpp.example.com:5275
Traceback (most recent call last):
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 171, in _process
while self.run and self.readXML():
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 217, in readXML
for (event, xmlobj) in cElementTree.iterparse(self.filesocket, (b'end', b'start')):
File "", line 61, in iter
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/filesocket.py", line 14, in read
data = self._sock.recv(size)
AttributeError: 'NoneType' object has no attribute 'recv'
DEBUG SEND:
WARNING Failed to send
ERROR Disconnected. Socket Error.
Traceback (most recent call last):
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 245, in _sendThread
self.socket.send(data.encode('utf-8'))
File "/usr/local/lib/python2.6/socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
DEBUG SEND: /stream:stream
WARNING Failed to send /stream:stream
ERROR Disconnected. Socket Error.
Traceback (most recent call last):
File "/home/django/projects/msm/lib/python2.6/site-packages/sleekxmpp/xmlstream/xmlstream.py", line 245, in _sendThread
self.socket.send(data.encode('utf-8'))
File "/usr/local/lib/python2.6/socket.py", line 165, in _dummy
raise error(EBADF, 'Bad file descriptor')
error: [Errno 9] Bad file descriptor
DEBUG Quitting eventRunner thread
DEBUG Connecting to xmpp.example.com:5275
DEBUG SEND:
DEBUG SEND: 61c82993e70ab4dd263ee962637ab8d5168732af
DEBUG RECV:
DEBUG RECV: /ns0:iq
DEBUG SEND: /stream:stream