XMPP Plus

Questions and comments specific to a particular plugin should go here.
User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Thu Aug 02, 2018 2:39 pm

this is what I have been explaining to you. it makes no friggin sense to me either. I am just as frustrated with it as you. I cannot seem to locate a library that is made for python that is still being maintained. I wish i had a better answer for ya. the only thing at this point I can suggest is find a library that is still being maintained and see if you can get the author to convert it to python 2
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 364
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP Plus

Post by Snowbird » Thu Aug 02, 2018 4:17 pm

ok, i will try to search but it would be hard to find a library working with python 2.x .......

in the meantime, is there a way for you to update the plugin, and make some changes to make it act as if EG were restarted when the plugin is disabled the re-enabled, it would be a workaround for me until we find something more accurate.

User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Fri Aug 03, 2018 3:27 am

hmmm. I am not sure if I can do that or not. I can give it a try and see what happens.
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 364
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP Plus

Post by Snowbird » Sat Aug 04, 2018 9:31 am

Last edited by Snowbird on Sat Aug 04, 2018 4:22 pm, edited 2 times in total.

User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Sat Aug 04, 2018 2:56 pm

Those links don't show anything except a google groups generic page.
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 364
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP Plus

Post by Snowbird » Sat Aug 04, 2018 4:21 pm

oops ! :oops: sorry
links are fixed now.

Snowbird
Experienced User
Posts: 364
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP Plus

Post by Snowbird » Sat Aug 04, 2018 5:20 pm

I'm pretty sure that the random drops in service, and the network change issue are related, if one is fixed the other will be fixed too.

But for now, let's focus on the network change issue, here is what happens when a network change occurs, step by step :

1. this information is returned :
'[Errno 10054] An existing connection was forcibly closed by the remote host'

2. then this one :
'[Errno 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond'

3. and finally this one :
'[Errno 9] Bad file descriptor'

4. upon next connection attempt, the error message is different :
'[Errno 10053] An established connection was aborted by the software in your host machine'

5. then followed by this one, and until EG is restarted it is repeated indefinitely :
'[Errno 9] Bad file descriptor'



Here's my interpretation of each step (correct me if I'm wrong) :
1. the connection is broken (there's nothing to worry about, it's an expected message since a network change has occurred)

2. a new connection attempt is taking place but couldn't succeed ! (I'm not sure I understand the exact reason...)

3. this error is just consequence not the root cause, i think we get this error message if a Python file was closed from "the outside", i.e. not from the file object's close() method.

4. a new connection attempt is taking place but this time the error is different. Could it be that the error was caused by the server closing the socket after it sent the first response ? which caused the client to receive a connection closed message when it tried to send the second message on the same connection ?

5. same as point 3.

I'm just trying to figure out what's happening, and I could be totally wrong about everything... I don't know if you have already checked that, but the MQTT plugin's connection mechanism is similar to the xmpp one (connection between client/server), the only difference between the 2 is that MQTT reconnects flawlessly when a network change occurs. Maybe you could check the code and see how it is done, there's no voodoo code in it I think :D It might worth checking that, I'm just saying.

I'm continuing my research, I hope to find another lib that works better, but for now I didn't find anything relevant.

User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Sat Aug 04, 2018 5:54 pm

I will tell you this. This problem has existed with. Sleekxmpp for 8 years and has never been fixed. It has been attempted but no solutions have been found. So that has to say something there. Not even to the Author has managed to fix the peoblem. I did a search on the Google groups for "sleekxmpp bad file descriptor" and it pulls up a couple of posts about it. And in one of them the author responds to the post stating that he was wanting someone to submit a fix and he would put it into the code. It seems as though no one has been able to nail down the actual cause of the problem. Some people say it has something to do with the asyn module and certificates others think it's an issue with TLS.
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 364
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP Plus

Post by Snowbird » Sat Aug 04, 2018 6:57 pm

Ok, dead end then... Damn !!

User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Sat Aug 04, 2018 11:17 pm

I ill do some poking about to see if i can locate a library that is being maintained. even if it is for python 3. I will then create a windows service out of it and have it pass information to a plugin for EG and when you use an action it will send the information over to the service for it to send.

This is the best that i can offer ya.
If you like the work I have been doing then feel free to Image

User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Sun Aug 05, 2018 5:55 pm

OK this is what I am doing.

I located a library that is still being maintained. it is aioxmpp. it is written for python 3. I started to write a wrapper for it that will run as a service on the PC. This service is going to open websocket ports, one for each server you are wanting to connect to. that EG is going to be able to connect to. and any "events" generated on the xmpp side are going to be passed to EG through this websocket. and any actions performed in EG are going to be passed from EG to the service through this websocket.

I have never dealt with writing any code that uses async IO or asyncio in python 3. so this is going to take me while to learn how to do. It will be a lot shorter then having to write a connector for xmpp from scratch. the xmpp protocol is massive and is also extremely complex. it would take a very long time to write a program from scratch.

This is what I have come up with. If it is not something that will work for ya then i am going to toss my hands up and walk away. :shock: There is not a whole lot of reason for me to consume a pretty good chunk of my existence on this planet writing code for a dying protocol.

So please let me know now if this would work.
If you like the work I have been doing then feel free to Image

HTPCanwender
Experienced User
Posts: 83
Joined: Wed Feb 08, 2012 9:41 pm
Location: Germany

Re: XMPP Plus

Post by HTPCanwender » Sun Aug 05, 2018 6:04 pm

As I told before, I am using openfire and XMPPplus on the same PC. When I terminate the connection in the openfire session report manually XMPPplus tries to reconnect without success permanently. The reconnect attempts don't stop, even when I deactivate the plugin. After restarting EG the connection is established again. Perhaps this scenario is suitable to find the reason for this behavior.

User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Mon Aug 06, 2018 7:09 am

that problem has existed for 8 years and in 8 years no one has been able to figure it out. it's all tied in with the server drops and bad file descriptor errors.

The sleekxmpp library has a pretty sizeable flaw in it that no one has been able to fix. The library has a lot of "voodoo magic" code in it. it's extremely hard to follow the data path through it. let alone trying to find out which specific bit is causing the issue. it is doing something that is causing the socket to have issues at the lower level. Even if i override the socket creation bits and pass in my own socket the issue still happens.

It very well could have something to do with DNS. i read a post somewhere that xmpp is very reliant upon DNS and using an IP address for the server can cause issues. it doesn't state what kinds of issues it can have. and I am not even sure where to look because when i sap out the socket and use one i provide that i have already connected it still has the same issue.

The guy that wrote the library has not been able to fix the issues with it and what is funny is that there are no bug reports on this problem on the github where the library is located. only on things like google groups and stackoverflow and being that the library is older I am gonna guess that the project started on some other version control platform and was migrated to github without taking all of the history with it.

This is the best solution I can come up with. it is a dying protocol specification there is not a whole lot out there that is still actively being maintained.
I am trying my best to make it work for ya. it is a very complex protocol and not something that one can simply whip together a plugin from scratch in just a few days. it would be something that would take quite a while to make. the API whitepapers read worse then stereo instructions.

It is simply to much effort to put in for a protocol that is on the way out. This is a last ditch effort i am making here to try to make this work for you guys.
If you like the work I have been doing then feel free to Image

Snowbird
Experienced User
Posts: 364
Joined: Fri Jul 03, 2009 10:04 am

Re: XMPP Plus

Post by Snowbird » Thu Mar 28, 2019 2:20 pm

Hi Kevin,

I hope you're doing fine ;)

I have noticed that there was a minor update recently for SleekXMPP :
https://github.com/fritzy/SleekXMPP

I'm not sure if it fixes our current problem, but at least we should try it I think, would you mind updating your plugin with this new version ?

I've also found some old issues that might help (or maybe not ?) they seem to have been fixed long time ago, It might be interesting reading them :
https://github.com/fritzy/SleekXMPP/issues/149
https://github.com/fritzy/SleekXMPP/issues/101

Just so you know, I still use your plugin intensively and daily, it works perfectly, but unfortunately when my internet connection goes down from time to time, the plugin stops working (because it's not able to reconnect to the server on its own...), i have to manually restart EG to make it work again, that's really a pain in the ass, to say the least...

I really hope someday this issue will be fixed.

Thanks.

User avatar
kgschlosser
Site Admin
Posts: 4949
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: XMPP Plus

Post by kgschlosser » Thu Mar 28, 2019 5:13 pm

I tried to get the python 3 xmpp library working using a program that would simulate using asyncio. Unfortunately that didn't work out.

I just looked over the PR's that have been merged in the library. None of them fix anything to do with the problem at hand. The one PR that got merged that i wrote has to deal with the tls certificates and this is already included in the plugin. so no need to update it. the other things are very minor changes.

However i did happen to notice from reading the code in one of the file a custom socket handler for lower versions of python. I will look at that and see if maybe the issue is it not getting remade when the socket takes a digger. this is what looks like is happening from the code i read.
If you like the work I have been doing then feel free to Image

Post Reply