grotor / pyvk-t

Automatically exported from code.google.com/p/pyvk-t
0 stars 0 forks source link

Ошибки в работе новой ветки (notwisted) #71

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Запуск прошёл хорошо, за исключением того, 
что парился почему он не читал
лог. Оказалось, что надо было подправить 
строчку в read и указать полный путь.

К серверу подключился, но через пару секунд 
вылетел вот с таким набором:

  *  2009-10-16 12:23:59,495 [ERROR] queue error
Traceback (most recent call last):
  File "/usr/local/lib/jabber/pyvk_notwisted/comstream.py", line 94, in
recvLoop
    self.recvQueue.put(etree.fromstring(s))
  File "lxml.etree.pyx", line 2538, in lxml.etree.fromstring
(src/lxml/lxml.etree.c:47980)
  File "parser.pxi", line 1536, in lxml.etree._parseMemoryDocument
(src/lxml/lxml.etree.c:71421)
  File "parser.pxi", line 1415, in lxml.etree._parseDoc
(src/lxml/lxml.etree.c:70282)
  File "parser.pxi", line 938, in lxml.etree._BaseParser._parseDoc
(src/lxml/lxml.etree.c:67206)
  File "parser.pxi", line 539, in
lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63588)
  File "parser.pxi", line 625, in lxml.etree._handleParseResult
(src/lxml/lxml.etree.c:64509)
  File "parser.pxi", line 565, in lxml.etree._raiseParseError
(src/lxml/lxml.etree.c:63852)
XMLSyntaxError: xmlns: 'Service Unavailable' is not a valid URI, line 1,
column 111

  *  2009-10-16 12:23:59,504 [ERROR] queue error
Traceback (most recent call last):
  File "/usr/local/lib/jabber/pyvk_notwisted/comstream.py", line 94, in
recvLoop
    self.recvQueue.put(etree.fromstring(s))
  File "lxml.etree.pyx", line 2538, in lxml.etree.fromstring
(src/lxml/lxml.etree.c:47980)
  File "parser.pxi", line 1536, in lxml.etree._parseMemoryDocument
(src/lxml/lxml.etree.c:71421)
  File "parser.pxi", line 1415, in lxml.etree._parseDoc
(src/lxml/lxml.etree.c:70282)
  File "parser.pxi", line 938, in lxml.etree._BaseParser._parseDoc
(src/lxml/lxml.etree.c:67206)
  File "parser.pxi", line 539, in
lxml.etree._ParserContext._handleParseResultDoc (src/lxml/lxml.etree.c:63588)
  File "parser.pxi", line 625, in lxml.etree._handleParseResult
(src/lxml/lxml.etree.c:64509)
  File "parser.pxi", line 565, in lxml.etree._raiseParseError
(src/lxml/lxml.etree.c:63852)
XMLSyntaxError: xmlns: 'Service Unavailable' is not a valid URI, line 1,
column 111

Traceback (most recent call last):
  File "main.py", line 32, in <module>
    s.main()
  File "/usr/local/lib/jabber/pyvk_notwisted/comstream.py", line 172, in main
    if (st.get("to").find(self.jid)!=-1):
AttributeError: 'NoneType' object has no attribute 'find'

Original issue reported on code.google.com by mro...@gmail.com on 16 Oct 2009 at 8:28

GoogleCodeExporter commented 8 years ago
В логе Jabberd2 пишет такое при подключении 
службы:
Fri Oct 16 12:23:47 2009 [error] Multiple components bound to single component 
route
'games.onego.ru'
Fri Oct 16 12:23:47 2009 [error] Multiple components bound to single component 
route
'games.onego.ru'
Fri Oct 16 12:23:47 2009 [notice] [78.36.60.82, port=61708] tried to send a 
packet
from 'vk.games.onego.ru', but that name is not bound to this component

Указал в поле server: vk.games.onego.ru и подключилось 
без ошибок, но не видно в
службах games.onego.ru.

В логе Jabberd2:

Fri Oct 16 12:56:18 2009 [notice] [78.36.60.82, port=54794] authenticated as
vk.games.onego.ru
Fri Oct 16 12:56:18 2009 [notice] [vk.games.onego.ru] online (bound to 
78.36.60.82,
port 54794)
Fri Oct 16 12:56:43 2009 [notice] [78.36.60.82, port=54794] disconnect
Fri Oct 16 12:56:43 2009 [notice] [vk.games.onego.ru] offline

Original comment by mro...@gmail.com on 16 Oct 2009 at 8:59

GoogleCodeExporter commented 8 years ago
Заменил значение в поле server на 78.36.60.82 - это IP 
games.onego.ru
В логе Jabberd2:

Fri Oct 16 13:01:28 2009 [notice] [78.36.60.82, port=57201] connect
Fri Oct 16 13:01:28 2009 [notice] [78.36.60.82, port=57201] authenticated as 
78.36.60.82
Fri Oct 16 13:01:28 2009 [notice] [78.36.60.82] online (bound to 78.36.60.82, 
port 57201)
Fri Oct 16 13:01:29 2009 [notice] [78.36.60.82, port=57201] tried to send a 
packet
from 'vk.games.onego.ru', but that name is not bound to this component
Fri Oct 16 13:01:54 2009 [notice] [78.36.60.82, port=57201] tried to send a 
packet
from 'vk.games.onego.ru', but that name is not bound to this component
Fri Oct 16 13:02:18 2009 [notice] [78.36.60.82, port=57201] disconnect
Fri Oct 16 13:02:18 2009 [notice] [78.36.60.82] offline

Original comment by mro...@gmail.com on 16 Oct 2009 at 9:03

GoogleCodeExporter commented 8 years ago
На пару мин упал инет... и транспорт за ним :-)

  *  2009-10-16 11:56:53,929 [ERROR] http error: IO Error, Reason: [Errno 51] Network
is unreachable., URL:http://vkontakte.ru/feed2.php
  *  2009-10-16 11:56:58,941 [ERROR] http error: IO Error, Reason: [Errno 51] Network
is unreachable., URL:http://vkontakte.ru/feed2.php
  *  2009-10-16 11:57:03,942 [ERROR] http error: IO Error, Reason: [Errno 51] Network
is unreachable., URL:http://vkontakte.ru/feed2.php
  *  2009-10-16 11:57:13,941 [ERROR] http error: IO Error, Reason: [Errno 51] Network
is unreachable., URL:http://vkontakte.ru/feed2.php
  *  2009-10-16 11:57:13,974 [ERROR] http error: IO Error, Reason: [Errno 51] Network
is unreachable., URL:http://vkontakte.ru/feed2.php
  *  2009-10-16 11:57:14,046 [ERROR] http error: IO Error, Reason: [Errno 51] Network
is unreachable., URL:http://vkontakte.ru/feed2.php
  *  2009-10-16 11:58:28,274 [CRITICAL] stream error
Traceback (most recent call last):
  File "/usr/local/lib/jabber/pyvk/comstream.py", line 89, in recvLoop
    s=self.getPacket()
  File "/usr/local/lib/jabber/pyvk/comstream.py", line 68, in getPacket
    c=self.sock.recv(1)
error: [Errno 65] No route to host

  *  2009-10-16 11:58:29,281 [ERROR] queue error
Traceback (most recent call last):
  File "/usr/local/lib/jabber/pyvk/comstream.py", line 94, in recvLoop
    self.recvQueue.put(etree.fromstring(s))
  File "lxml.etree.pyx", line 2538, in lxml.etree.fromstring
(src/lxml/lxml.etree.c:47980)
  File "parser.pxi", line 1533, in lxml.etree._parseMemoryDocument
(src/lxml/lxml.etree.c:71383)
ValueError: can only parse strings

Original comment by hart...@gmail.com on 16 Oct 2009 at 9:07

GoogleCodeExporter commented 8 years ago
А ещё вот так:
ERR: error in deferred: <type 'exceptions.TypeError'> (<bound method
Failure.getErrorMessage of <twisted.python.failure.Failure <type
'exceptions.TypeError'>>>)
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/threading.py", line 477, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/usr/local/lib/jabber/pyvk/pyvkt_spikes.py", line 120, in loop
    elem["deferred"].callback(res)
  File "/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py", line 243,
in callback
    self._startRunCallbacks(result)
  File "/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py", line 312,
in _startRunCallbacks
    self._runCallbacks()
--- <exception caught here> ---
  File "/usr/local/lib/python2.6/site-packages/twisted/internet/defer.py", line 328,
in _runCallbacks
    self.result = callback(self.result, *args, **kw)
  File "/usr/local/lib/jabber/pyvk/pyvkt.py", line 333, in msgDeliveryNotify
    msg=createElement("message",{'to':jid,'from':src,'id':msg_id})
  File "/usr/local/lib/jabber/pyvk/comstream.py", line 25, in createElement
    ret.set(i,attrs[i])
  File "lxml.etree.pyx", line 634, in lxml.etree._Element.set
(src/lxml/lxml.etree.c:31223)

  File "apihelpers.pxi", line 447, in lxml.etree._setAttributeValue
(src/lxml/lxml.etree.c:13448)

  File "apihelpers.pxi", line 1203, in lxml.etree._utf8 (src/lxml/lxml.etree.c:19419)

exceptions.TypeError: Argument must be string or unicode.

Original comment by hart...@gmail.com on 16 Oct 2009 at 10:11

GoogleCodeExporter commented 8 years ago
И вот так:

  *  2009-10-16 12:55:16,000 [ERROR] Traceback (most recent call last):
  File "/usr/local/lib/jabber/pyvk/pyvkt_spikes.py", line 97, in loop
    res=f(**args)
  File "/usr/local/lib/jabber/pyvk/pyvkt_user.py", line 438, in refreshData
    self.trans.updateFeed(self.bjid,tfeed)
  File "/usr/local/lib/jabber/pyvk/pyvkt.py", line 1444, in updateFeed
    if not (oldfeed and (j in oldfeed) and ("items" in oldfeed[j]) and (i in
oldfeed[j]["items"])):
TypeError: argument of type 'NoneType' is not iterable

Original comment by hart...@gmail.com on 16 Oct 2009 at 10:14

GoogleCodeExporter commented 8 years ago
2mroztn:
посмотрю.. в нынешней версии открытие 
сессии с сервом сильно криво сделано.

2Hartois:
надо новый багрепорт создавать, а не в кучу 
скидывать... ну и срач, простите...
ему коннект с сервом разорвали, что ему 
оставалось делать, кроме как упасть??

Original comment by Equidamoid on 16 Oct 2009 at 3:15

GoogleCodeExporter commented 8 years ago
2Equidamoid:
вот если б с жаббер-сервером - я бы ещё 
понял, а так...

Original comment by hart...@gmail.com on 19 Oct 2009 at 5:33

GoogleCodeExporter commented 8 years ago
Последняя ревизия. Начало вываливаться с 
ошибкой:
  *  2009-10-27 07:27:16,618 [CRITICAL] exception:
Traceback (most recent call last):
  File "main.py", line 38, in <module>
    s.main()
  File "/usr/local/lib/jabber/pyvk/pyvkt/comstream.py", line 194, in main
    print_exc()
NameError: global name 'print_exc' is not defined

Original comment by mro...@gmail.com on 27 Oct 2009 at 4:28

GoogleCodeExporter commented 8 years ago
Не исправленные ошибки в 171 ревизии:

Index: comstream.py                                                             

===================================================================             

--- comstream.py        (revision 169)                                          

+++ comstream.py        (working copy)                                          

@@ -51,7 +51,7 @@                                                               

         self.secret=secret                                                         

         sock=socket.create_connection((host,port))                                 

         #FIXME connecting                                                          

-        sock.send("<stream:stream xmlns='jabber:component:accept'
xmlns:stream='http://etherx.jabber.org/streams' to='%s'>"%host)   
+        sock.send("<stream:stream xmlns='jabber:component:accept'
xmlns:stream='http://etherx.jabber.org/streams' to='%s'>"%self.jid)             

         sock.recv(len("<?xml version='1.0'?>"))                                    

         fil=sock.makefile(bufsize=1)                                               

         rep= sock.recv(1000)                                                       

Index: pyvkt.py                                                                 

===================================================================             

--- pyvkt.py    (revision 169)                                                  

+++ pyvkt.py    (working copy)                                                  

@@ -155,11 +155,11 @@                                                           

         self.unregisteredList=[]                                                   

         signal.signal(signal.SIGUSR1,self.signalHandler)                           

     def handlePacket(self,st):                                                     

-        if (st.tag=="message"):                                                

+        if (st.tag=="{jabber:client}message"):                                 

             self.onMsg(st)                                                         

-        if (st.tag=="iq"):                                                     

+        if (st.tag=="{jabber:client}iq"):                                      

             self.onIq(st)                                                          

-        if (st.tag=="presence"):                                               

+        if (st.tag=="{jabber:client}presence"):                                

             self.onPresence(st)                                                    

     def onMsg(self,msg):                                                           

         src=msg.get("from")                                                        

Original comment by mro...@gmail.com on 27 Oct 2009 at 4:35

GoogleCodeExporter commented 8 years ago
Index: pyvkt/comstream.py                                                       

===================================================================             

--- pyvkt/comstream.py  (revision 173)                                          

+++ pyvkt/comstream.py  (working copy)                                          

@@ -56,7 +56,15 @@                                                              

         sock.send("<stream:stream xmlns='jabber:component:accept'
xmlns:stream='http://etherx.jabber.org/streams' to='%s'>"%self.jid)             

         sock.recv(len("<?xml version='1.0'?>"))                                    

         fil=sock.makefile(bufsize=1)                                               

-        rep= sock.recv(1000)                                                   

+        try:                                                                   

+            rep=sock.recv(1000)                                                

+        except socket.error,e:                                                 

+            if (e.errno in (11,35)):                                           

+                time.sleep(1)                                                  

+            else:                                                              

+                self.connectionFailure=True                                    

+                logging.exception('recv failure')                              

+                raise                                                          

         ids=rep.find("id='")                                                       

         ide=rep.find("'",ids+5)                                                    

         sid=rep[ids+4:ide]                                                         

@@ -81,7 +89,7 @@                                                               

                 if (c=='>'):                                                       

                     break                                                          

             except socket.error,e:                                                 

-                if (e.errno==11):                                              

+                if (e.errno in (11,35)):                                       

                     time.sleep(1)                                                  

                 else:                                                              

                     self.connectionFailure=True                                    

@@ -99,7 +107,7 @@                                                              

                     return                                                         

                 sn=sn+self.sock.recv(1)
             except socket.error,e:
-                if (e.errno==11):
+                if (e.errno in (11,35)):
                     time.sleep(1)
                 else:
                     self.connectionFalure=True

Original comment by mro...@gmail.com on 7 Nov 2009 at 3:47

GoogleCodeExporter commented 8 years ago
--- pyvkt/comstream.py  (revision 176)
+++ pyvkt/comstream.py  (working copy)
@@ -68,11 +76,11 @@
         sock.settimeout(0)
         self.sock=sock

-        if (self.getPacket(True)=='<handshake/>'):
+        if (self.getPacket(True).find('handshake') != -1):
             self.connFailure=False

Original comment by mro...@gmail.com on 17 Nov 2009 at 7:10

GoogleCodeExporter commented 8 years ago
--- pyvkt/component.py  (revision 176)
+++ pyvkt/component.py  (working copy)
@@ -90,18 +90,12 @@
         signal.signal(signal.SIGUSR1,self.signalHandler)
         signal.signal(signal.SIGUSR2,self.signalHandler)
     def handlePacket(self,st,tryNS=True):
-        if (st.tag=="message"):
+        if (st.tag.find("message") != -1):
             return self.onMsg(st)
-        if (st.tag=="iq"):
+        if (st.tag.find("iq") != -1):
             return self.onIq(st)
-        if (st.tag=="presence"):
+        if (st.tag.find("presence") != -1):
             return self.onPresence(st)
-        if (tryNS):
-            #FIXME
-            if (st.tag.find('{jabber:client}')):
-                st.tag=st.tag.replace('{jabber:client}','')
-                logging.warning('namespace fixed')
-                return self.handlePacket(st,tryNS=False)
         logging.warning('unexpected stranza: "%s"'%st.tag)
     def onMsg(self,msg):
         src=msg.get("from")

Original comment by mro...@gmail.com on 17 Nov 2009 at 7:14

GoogleCodeExporter commented 8 years ago
Патч для 177: http://dumpz.org/14379/

Original comment by mro...@gmail.com on 18 Nov 2009 at 9:50