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

100% нагрука на сервер #92

Open
GoogleCodeExporter opened this issue Nov 27, 2015 · 25 comments
Open

100% нагрука на сервер #92

GoogleCodeExporter opened this issue Nov 27, 2015 · 25 comments

Comments

@GoogleCodeExporter
Copy link

Использую UBUNTU 9.10.
Все нужные компоненты установлены.
При запуске скрипта проц подвешывается на 
100%. испоьлзую поседнюю ревизию.
Сервер OpenFire.

{'debug': {'dump_path': None}, 'storage': {'datadir': u'./data', 'cache': 
u'./cache', 'cookies': u'./cookies'}, 'workarounds': {'fix_namespaces': 
False}, 'features': {'status': u'Vkontakte', 'sync_status': True, 
'avatars': True}, 'general': {'jid': u'jabber.server.ru', 'admin': 
u'admin@localhost', 'service_name': u'pyvk-t', 'server': 
u'jabber.chgpgt.ru', 'secret': u'micr', 'port': 5349}}
^CTraceback (most recent call last):
  File "main.py", line 46, in <module>
    if not s.connect(conf.get("general","server"),conf.get
("general","port"),conf.get("general","secret")):
  File "/root/pyvk-t/pyvkt/comstream.py", line 119, in connect
    handshake_answer=self.getPacket(True)
  File "/root/pyvk-t/pyvkt/comstream.py", line 140, in getPacket
    c=self.sock.recv(1)

Original issue reported on code.google.com by [email protected] on 24 Feb 2010 at 12:06

@GoogleCodeExporter
Copy link
Author

Если в конфиге меняю как по инструкции jid на 
vkontakte.myserver.ru то получаю [CRI] 
<module>[MainThread]: can't connect

сейчас стоит jid: myserver.ru

Original comment by [email protected] on 24 Feb 2010 at 12:19

@GoogleCodeExporter
Copy link
Author

[deleted comment]

1 similar comment
@GoogleCodeExporter
Copy link
Author

[deleted comment]

@GoogleCodeExporter
Copy link
Author

Debug

root@jabber:~/pyvk-t# python main.py -m debug
{'debug': {'dump_path': None}, 'storage': {'datadir': u'./data', 'cache': u'./
cache', 'cookies': u'./cookies'}, 'workarounds': {'fix_namespaces': False}, 
'features': {'status': u'Vkontakte', 'sync_status': True, 'avatars': True}, 
'general': {'jid': u'vkontate.server.ru', 'admin': u'admin@localhost', 
'service_name': u'pyvk-t', 'server': u'jabber.server.ru', 'secret': u'pass', 
'port': 5349}}
  *  2010-02-24 17:24:29,129 [DEB] connect[MainThread]: Received server auth answer: 
<?xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://
etherx.jabber.org/streams" xmlns="jabber:component:accept" 
from="vkontate.jabber.chgpgt.ru" id="2575ef7">
  *  2010-02-24 17:24:29,140 [DEB] connect[MainThread]: Received handshake answer: 
<stream:error xmlns:stream="http://etherx.jabber.org/streams"><not-authorized 
xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></stream:error>
  *  2010-02-24 17:24:29,141 [CRI] <module>[MainThread]: can't connect
root@jabber:~/pyvk-t# 

Original comment by [email protected] on 24 Feb 2010 at 12:33

@GoogleCodeExporter
Copy link
Author

Во-первых JID компоненты должен быть вида 
<имя>.<адрес_сервера>
Например: vk.site.ru

Во-вторых сделать руками багфикс:
Index: component.py
===================================================================
--- component.py    (revision 193)
+++ component.py    (working copy)
@@ -357,6 +357,8 @@
         ans=createElement('iq',attrs={'from':dest,'to':src,
'id':iq.get('id'),'type':'result'})
         #logging.warning(iq.get('type'))
         logging.info("RECV: iq (%s) %s -> %s"%(iq.get('type'),src,dest))
+        if (iq.get('type')=='error'):
+            return False
         if (iq.get('type')=='get'):
             #FIXME TODO commands
             r,a=getQuery(iq,ans,'http://jabber.org/protocol/disco#info')

Original comment by [email protected] on 24 Feb 2010 at 2:13

@GoogleCodeExporter
Copy link
Author

В-третьих проверить логи Jabber-сервера. 
Потому что ошибка говорит о том, что сервер
не авторизует компоненту.

Original comment by [email protected] on 24 Feb 2010 at 2:15

@GoogleCodeExporter
Copy link
Author

Просмотрел все три исправления....ничего не 
изменилось
[CRI] <module>[MainThread]: can't connect
у меня прикручен таким же способом 
транспорт mrim и он работает на ура. что еще 
следует посмотреть и/или исправить?

Original comment by [email protected] on 25 Feb 2010 at 7:12

@GoogleCodeExporter
Copy link
Author

Конфигурационный файл

[general]
jid: vkontakte.jabber.server.ru
server: localhost
secret: password
port: 5349
admin: admin@localhost
service_name: pyvk-transport

[features]
avatars: true
sync_status: true
status: Vkontakte

[storage]
cache: ./cache
datadir: ./data
cookies: ./cookies

[debug]
dump_path: dumps

Original comment by [email protected] on 25 Feb 2010 at 8:25

@GoogleCodeExporter
Copy link
Author

Я же написал: проверить логи Jabber-сервера. 
Потому что ошибка говорит о том, что сервер
не авторизует компоненту.

Original comment by [email protected] on 25 Feb 2010 at 11:23

@GoogleCodeExporter
Copy link
Author

Единственное что говорят логи:

2010.02.25 17:04:24 LocalComponentSession: [ExComp] Starting registration of 
new 
external component for domain: vkontakte.jabber.server.ru 
2010.02.25 17:04:24 078815 (01/05/00) - Connection #4 tested: OK 
2010.02.25 17:04:24 078816 (01/05/00) - Connection #4 tested: OK 
2010.02.25 17:04:24 078816 (01/05/00) - Connection #5 tested: OK 
2010.02.25 17:04:24 078817 (01/05/00) - Connection #5 tested: OK 
2010.02.25 17:04:24 078817 (01/05/00) - Connection #1 tested: OK 
2010.02.25 17:04:24 078818 (01/05/00) - Connection #1 tested: OK 
2010.02.25 17:04:24 078818 (01/05/00) - Connection #2 tested: OK 
2010.02.25 17:04:24 078819 (01/05/00) - Connection #2 tested: OK 
2010.02.25 17:04:24 LocalComponentSession: [ExComp] Send stream header with ID: 
cffdff5d for component with domain: vkontakte.jabber.server.ru 
2010.02.25 17:04:24 078819 (01/05/00) - Connection #3 tested: OK 
2010.02.25 17:04:24 078820 (01/05/00) - Connection #3 tested: OK 
2010.02.25 17:04:24 078820 (01/05/00) - Connection #4 tested: OK 
2010.02.25 17:04:24 078821 (01/05/00) - Connection #4 tested: OK 
2010.02.25 17:04:24 LocalComponentSession: [ExComp] Incorrect handshake for 
component with domain: vkontakte

Original comment by [email protected] on 25 Feb 2010 at 12:08

@GoogleCodeExporter
Copy link
Author

Ну вот значит копать надо в сорце 
транспорта и смотреть как он там отвечает 
на
хэндшейк. Смотреть надо в comstream.py там можно 
сделать поиск по слову handshake.

Original comment by [email protected] on 25 Feb 2010 at 2:59

@GoogleCodeExporter
Copy link
Author

Придется ждать багфикса.
может быть проблема в том что у меня имя 
сервера состоит из домена второго уровня?

Original comment by [email protected] on 26 Feb 2010 at 3:49

@GoogleCodeExporter
Copy link
Author

Да вряд ли багфикс последует. Делайте 
дебаг-вывод в транспорте и смотрите какой
хэндшейк транспорт отправляет, а какой 
хендшейк сервер ожидает. Под ejabberd, prosody
и jabberd2 таких проблем не наблюдалось, но под 
jabberd2 у меня была проблема с
хэндшейком, исправил быстренько. :)

Original comment by [email protected] on 26 Feb 2010 at 6:14

@GoogleCodeExporter
Copy link
Author

я так понимаю надо смотреть после слов:
"Да, я знаю, костыль на костыле и костылем 
погоняет."

Не могли бы, Вы <B>mroztn</B>, выложить или 
подсказть что именно вы меняли? или это 
сугубо индивидуальная проблема? заранее 
спасибо

Original comment by [email protected] on 26 Feb 2010 at 7:46

@GoogleCodeExporter
Copy link
Author

Смотреть надо в def connect(self,host,port,secret)
Там мы видим обмен хэндшейками, ну и можно 
прикрутить вывод дополнительный.

    def connect(self,host,port,secret):
        self.host=host
        self.port=port
        self.secret=secret
        #sock=socket.create_connection((host,port))
    sock=connect_socket((host,port))
        #FIXME connecting
        sock.send("<stream:stream xmlns='jabber:component:accept'
xmlns:stream='http://etherx.jabber.org/streams' to='%s'>"%self.jid)
        #fil=sock.makefile(bufsize=1)
        rep=sock.recv(1000)
        rep=rep.replace("<?xml version='1.0'?>", "") # Replacing sock.recv(len("<?xml
version='1.0'?>"))
        logging.debug('Received server auth answer: %s'%rep)
        ids=rep.find("id='")
        ide=rep.find("'",ids+5)
        sid=rep[ids+4:ide]
        hsh=hashlib.sha1(str(sid)+secret).hexdigest()
        resp="<handshake>%s</handshake>"%hsh
        sock.send(resp)
        if (0):
            sock.settimeout(None)
        else:
            sock.settimeout(3)
        self.sock=sock
        handshake_answer=self.getPacket(True)
        logging.debug('Received handshake answer: %s'%handshake_answer)
        #FIXME Namespaces
        if (handshake_answer=='<handshake/>'):
            self.connFailure=False
            self.connected.acquire()
            self.connected.notifyAll()
            self.connected.release()
            return True
        return False


То, что я исправлял было актуально лишь для 
jabberd2 и в svn потом это было исправлено.

Original comment by [email protected] on 26 Feb 2010 at 10:32

@GoogleCodeExporter
Copy link
Author

Видимо не получится у меня прикрутить сей 
транспорт, а так хочется :-(....

Original comment by [email protected] on 26 Feb 2010 at 10:54

@GoogleCodeExporter
Copy link
Author

Я также написал модуль для сервера Prosody. :) 
Но вряд ли он вам интересен, т.к. у
вас OpenFire.

Original comment by [email protected] on 26 Feb 2010 at 2:18

@GoogleCodeExporter
Copy link
Author

К сожалению вы правы, не смогу уже 
отказаться от OpenFire :-(
остается ждать решения задачи, ибо сам 
решить не смогу от не знания :-(
Очень жду помощи

Original comment by [email protected] on 26 Feb 2010 at 3:03

@GoogleCodeExporter
Copy link
Author

Добавьте logging.debug('Received handshake answer: %s'%handshake_answer)
в место, где оно есть выше! :)
И можно выдержку из лога после запуска.

Original comment by [email protected] on 26 Feb 2010 at 7:06

@GoogleCodeExporter
Copy link
Author

debug запуска

root@jabber:~/pyvk-t# ./main.py -m -debug
{'debug': {'dump_path': u'dumps'}, 'storage': {'datadir': u'./data', 'cache': 
u'./
cache', 'cookies': u'./cookies'}, 'workarounds': {'fix_namespaces': False}, 
'features': {'status': u'Vkontakte', 'sync_status': True, 'avatars': True}, 
'general': {'jid': u'vkontakte.jabber.server.ru', 'admin': u'admin@localhost', 
'service_name': u'pyvk-transport', 'server': u'localhost', 'secret': u'pass', 
'port': 5349}}
  *  2010-02-27 13:15:09,309 [DEB] connect[MainThread]: Received handshake answer: <?
xml version='1.0' encoding='UTF-8'?><stream:stream xmlns:stream="http://
etherx.jabber.org/streams" xmlns="jabber:component:accept" 
from="vkontakte.jabber.server.ru" id="caa98331">
  *  2010-02-27 13:15:10,313 [WAR] getPacket[MainThread]: received <stream:error 
xmlns:stream="http://etherx.jabber.org/streams"><not-authorized 
xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></stream:error>
  *  2010-02-27 13:15:10,314 [DEB] connect[MainThread]: Received handshake answer: 
<stream:error xmlns:stream="http://etherx.jabber.org/streams"><not-authorized 
xmlns="urn:ietf:params:xml:ns:xmpp-streams"/></stream:error>
  *  2010-02-27 13:15:10,314 [CRI] <module>[MainThread]: can't connect

Это на сервере:

2010.02.27 13:16:50 LocalComponentSession: [ExComp] Starting registration of 
new 
external component for domain: vkontakte.jabber.server.ru 
2010.02.27 13:16:50 LocalComponentSession: [ExComp] Send stream header with ID: 
8c4355e9 for component with domain: vkontakte.jabber.server.ru 
2010.02.27 13:16:50 LocalComponentSession: [ExComp] Incorrect handshake for 
component with domain: vkontakte

Original comment by [email protected] on 27 Feb 2010 at 8:33

@GoogleCodeExporter
Copy link
Author

Видимо не будут жить в рабочем состоянии 
OpenFire и Pyvk-t

Original comment by [email protected] on 1 Mar 2010 at 10:16

@GoogleCodeExporter
Copy link
Author

Если у кого-то работает такая связка, 
отпишитесь плиз

Original comment by [email protected] on 2 Mar 2010 at 12:23

@GoogleCodeExporter
Copy link
Author

Все же рекомендую ознакомиться с сервером 
Prosody. :)
Уж очень хорош!

Original comment by xdersd on 2 Mar 2010 at 3:33

@GoogleCodeExporter
Copy link
Author

Спасибо за рекомендации, но как и писал 
выше, не смогу отказаться от сервера OpenFire

Original comment by [email protected] on 4 Mar 2010 at 9:28

@GoogleCodeExporter
Copy link
Author

если поменять в comstream.py

        rep=rep.replace("<?xml version='1.0'?>", "") # Replacing sock.recv(len("<?xml
version='1.0'?>"))
        logging.debug('Received server auth answer: %s'%rep)
        ids=rep.find("id='")
        ide=rep.find("'",ids+5)
        sid=rep[ids+4:ide]


на 

        rep=rep.replace("<?xml version='1.0'?>", "") # Replacing sock.recv(len("<?xml
version='1.0'?>"))
        logging.debug('Received server auth answer: %s'%rep)
        ids=rep.find("id=\"")
        ide=rep.find("\"",ids+5)
        sid=rep[ids+4:ide]

(апостроф на двойные кавычки) то момент с 
авторизацией проскакивает, но дальше особо
легче не становится....

Original comment by [email protected] on 8 May 2010 at 8:54

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

1 participant