Notification not working

General support for problems installing or using Deluge
Post Reply
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

I got it to work on Debian too! I just thought of something that might work and it did. Let me explain. So my setup is like this:

Site A <-> IPsec tunnel <-> Site B

The deluge we were troubleshooting was in Site B and all its traffic goes through the tunnel to Site A and eventually to the Internet. This is working just fine for everything except for the Notifications in deluge which, for the life of me, I couldn't figure out why. TLS does not break when traversing a VPN tunnel. Even though IPsec is technically UDP it encapsulates the TCP packets that traverse it anyway. And to prove that, I don't have any problems browsing the Internet from a device in Site B that has all its traffic going through the tunnel to Site A. This is a very common setup for a main office/branch office company (mine are just two homes connected to each other though). So I'm still baffled as to why it's not working before.

For the heck of it, I did the python3 test you had for me and look how different the results are this time:

Code: Select all

>>> from smtplib import SMTP
>>> user="redacted"
>>> pw="redacted"
>>> server = SMTP('smtp.gmail.com', 587)
>>> server.set_debuglevel(1)
>>> server.ehlo()
send: 'ehlo [192.168.20.101]\r\n'
reply: b'250-smtp.gmail.com at your service, [redacted]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-STARTTLS\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
(250, b'smtp.gmail.com at your service, [redacted]\nSIZE 35882577\n8BITMIME\nSTARTTLS\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8')
>>> server.starttls()
send: 'STARTTLS\r\n'
reply: b'220 2.0.0 Ready to start TLS\r\n'
reply: retcode (220); Msg: b'2.0.0 Ready to start TLS'
(220, b'2.0.0 Ready to start TLS')
>>> server.login(user,pw)
send: 'ehlo [192.168.20.101]\r\n'
reply: b'250-smtp.gmail.com at your service, [redacted]\r\n'
reply: b'250-SIZE 35882577\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-AUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\r\n'
reply: b'250-ENHANCEDSTATUSCODES\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-CHUNKING\r\n'
reply: b'250 SMTPUTF8\r\n'
reply: retcode (250); Msg: b'smtp.gmail.com at your service, [redacted]\nSIZE 35882577\n8BITMIME\nAUTH LOGIN PLAIN XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER XOAUTH\nENHANCEDSTATUSCODES\nPIPELINING\nCHUNKING\nSMTPUTF8'
send: 'AUTH PLAIN AGtldmluZGQ5OTIwMDJAZ21haWwuY29tAERyZWFtY2FzdDA5MjExOTg3\r\n'
reply: b'235 2.7.0 Accepted\r\n'
reply: retcode (235); Msg: b'2.7.0 Accepted'
(235, b'2.7.0 Accepted')
>>> server.sendmail(user, user, "test")
send: 'mail FROM:<kevindd992002@gmail.com> size=4\r\n'
reply: b'250 2.1.0 OK gf23sm6846481pjb.48 - gsmtp\r\n'
reply: retcode (250); Msg: b'2.1.0 OK gf23sm6846481pjb.48 - gsmtp'
send: 'rcpt TO:<kevindd992002@gmail.com>\r\n'
reply: b'250 2.1.5 OK gf23sm6846481pjb.48 - gsmtp\r\n'
reply: retcode (250); Msg: b'2.1.5 OK gf23sm6846481pjb.48 - gsmtp'
send: 'data\r\n'
reply: b'354  Go ahead gf23sm6846481pjb.48 - gsmtp\r\n'
reply: retcode (354); Msg: b'Go ahead gf23sm6846481pjb.48 - gsmtp'
data: (354, b'Go ahead gf23sm6846481pjb.48 - gsmtp')
send: b'test\r\n.\r\n'
reply: b'250 2.0.0 OK  1610368675 gf23sm6846481pjb.48 - gsmtp\r\n'
reply: retcode (250); Msg: b'2.0.0 OK  1610368675 gf23sm6846481pjb.48 - gsmtp'
data: (250, b'2.0.0 OK  1610368675 gf23sm6846481pjb.48 - gsmtp')
{}
>>> server.quit()
send: 'quit\r\n'
reply: b'221 2.0.0 closing connection gf23sm6846481pjb.48 - gsmtp\r\n'
reply: retcode (221); Msg: b'2.0.0 closing connection gf23sm6846481pjb.48 - gsmtp'
(221, b'2.0.0 closing connection gf23sm6846481pjb.48 - gsmtp')
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

That's great to hear, good job mate, glad to hear it! :) Indeed that output of the python code is the expected result like mine always looked like, so was baffled at your output seemingly hanging after tls initiation, prior to the sendmail() call.

Btw, about your previous post about not being able to save the config, then they shouldn't really be able to conflict eachother, and have never seen it myself. Btw, 2 days ago I updated the original link for notifications2 because I forgot I used notifications2-gtk.conf and so changed it to notifications-gtk.conf, so as to fully match notifications original setup, like with notifications-core.conf(which is most important), but doesn't explain your issue, but just for complete info if using old version(and forgot say originally but not important really).

I had however during many testings, one single case of that I could enable notifications2 fine and set it up, but I saw in the terminal I opened deluge from, that it showed some twisted-deferred error about amongst else, gtkui.py. That was an issue always occuring originally when trying change name to notifications2, and I got fixed and didn't saw again in 20+ next run's about, on neither arch, win10 or ubuntu, but then saw it again one single time yesterday during troubleshooting on ubuntu, but not again afterwards, so really strange and I just thought it was a fluke someway, but i'm thinking if you maybe occured that too possibly, as could be it wouldn't save the config in that case possibly, though doesn't explain why the original notifications plugin also behaving that way afterwards, so don't know really.

If wanting to be absolutely sure of that the above never happens(but don't know if your issue but could be), as I cannot fix as don't know why happened that single time, then instead use the more akward version with gtkui/webui config support stripped out, so no notifications2 submenu coming forward after enabling it, meaning you enable notifications2 plugin and keep it enabled always, and then enable original notifications plugin temporarily only when needing make changes or check settings, and then after changing anything you hit apply and then disable original notifications plugin again and apply/save, leaving notifications2 only enabled option again. Here it is again, https://paste.c-net.org/UnlawfulComfy , sorry for inconvenience.

Again, kudos on fixing your issue, great job :)
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

mhertz wrote:That's great to hear, good job mate, glad to hear it! :) Indeed that output of the python code is the expected result like mine always looked like, so was baffled at your output seemingly hanging after tls initiation, prior to the sendmail() call.

Btw, about your previous post about not being able to save the config, then they shouldn't really be able to conflict eachother, and have never seen it myself. Btw, 2 days ago I updated the original link for notifications2 because I forgot I used notifications2-gtk.conf and so changed it to notifications-gtk.conf, so as to fully match notifications original setup, like with notifications-core.conf(which is most important), but doesn't explain your issue, but just for complete info if using old version(and forgot say originally but not important really).

I had however during many testings, one single case of that I could enable notifications2 fine and set it up, but I saw in the terminal I opened deluge from, that it showed some twisted-deferred error about amongst else, gtkui.py. That was an issue always occuring originally when trying change name to notifications2, and I got fixed and didn't saw again in 20+ next run's about, on neither arch, win10 or ubuntu, but then saw it again one single time yesterday during troubleshooting on ubuntu, but not again afterwards, so really strange and I just thought it was a fluke someway, but i'm thinking if you maybe occured that too possibly, as could be it wouldn't save the config in that case possibly, though doesn't explain why the original notifications plugin also behaving that way afterwards, so don't know really.

If wanting to be absolutely sure of that the above never happens(but don't know if your issue but could be), as I cannot fix as don't know why happened that single time, then instead use the more akward version with gtkui/webui config support stripped out, so no notifications2 submenu coming forward after enabling it, meaning you enable notifications2 plugin and keep it enabled always, and then enable original notifications plugin temporarily only when needing make changes or check settings, and then after changing anything you hit apply and then disable original notifications plugin again and apply/save, leaving notifications2 only enabled option again. Here it is again, https://paste.c-net.org/UnlawfulComfy , sorry for inconvenience.

Again, kudos on fixing your issue, great job :)
Thanks for all your help, btw!

I think I'm using the updated version of your egg file. I don't have notifications2-core.conf anywhere anyway. And when I downloaded that egg file, you already mentioned about that issue. But yeah, I'll download Notifications2 again and see if it happens again. While testing it in my Synology NAS docker container earlier, there were all sorts of weird behavior really. The one I explained was the initial observation. While I was trying to change recipients in the GUI settings, "sometimes" the Notifications2 submenu is able to update the conf file properly. Most of the times, it doesn't. There was even a time where I udpated the settings using the Notifications submenu, disabled the Notifications plugin and re-enabled the Notifications2 plugin, went to Notifications2 submenu, clicked Apply and OK, and it reset the conf to its default "disabled" state. So yeah, I don't know.
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

You're most welcome mate - I did learn something new along the way, which always is nice too, about smtplib, tls/ssl and docker :)

The notifications plugin in general can also be little buggy, sometimes recipients was reset and not saved in config, even in original plugin version.

There's two config files: notifications-core.conf and notifications-gtk.conf, and I forgot to have the gtk one shared between the two plugins(different names of config file, one having '2' in name), hence the reupload. Anyway, the last link in previous post should be most stable atleast(not the version reuploaded and mentioned before, just to make sure coming through correctly - not good at explaining sometimes), just you have to setup/check with original notifications - annoying that you couldn't just use the very first fixed version with upped version number, to avoid these hoops altogether of seperate notifications2 plugin, but your docker doesn't wanna accept it you showed from log so nothing to do about that then.

Cheers, good teamwork btw, I know you found the issue yourself but just mean in general :)
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

I tried using the egg in https://paste.c-net.org/UnlawfulComfy and it has the same issue. The only signal I see that I know for sure that the conf file was updated properly is if when I click OK and the settings box closes. If after pressing OK it doesn't close, I know for sure that the conf file was not updated. I guess I'll just manually edit the conf file, lol.

Definitely good teamwork :) I'm glad I was able to contribute something to solve my own issue.
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

OK, then that is the original notifications plugin, or deluge in general, that is buggy then, as that version of plugin doesn't save the config file and only reads it when available, but good that you just edit the conf directly as workaround and found when behaves badly from it's appearance.

Cheers! :)
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

@mhertz

I see there's a milestone here:

https://dev.deluge-torrent.org/ticket/3303#comment:6

What does that mean? Does it mean it is officially fixed?
mhertz
Moderator
Moderator
Posts: 2182
Joined: Wed Jan 22, 2014 5:05 am
Location: Denmark

Re: Notification not working

Post by mhertz »

No, it means Cas verified its an issue, and not e.g just a misunderstanding, and that it's scheduled to be fixed for the 2.0.4 coming release. Cas seemingly went through the issues ticket stack today as I got also another notification besides this one, about a ticket closed, as issue resolved and I forgot myself close. 4 new commits today also I see, in development branch, great to see Cas at it :) Nothing related to notification plugin yet though.

https://git.deluge-torrent.org/deluge/log/?h=develop
kevindd992002
Leecher
Leecher
Posts: 71
Joined: Thu Jun 13, 2019 2:56 pm

Re: Notification not working

Post by kevindd992002 »

I see what you mean. Thanks for the confirmation!
Cas
Top Bloke
Top Bloke
Posts: 3679
Joined: Mon Dec 07, 2009 6:04 am
Location: Scotland

Re: Notification not working

Post by Cas »

This diff should fix the issue, I will test it myself later. The error is because get_status requires a specific list of keys and without that or without using the argument all_keys it will return nothing.

Code: Select all

--- deluge/plugins/Notifications/deluge_notifications/core.py
+++ deluge/plugins/Notifications/deluge_notifications/core.py
@@ -176,7 +176,7 @@ def _notify_email(self, subject='', message=''):
     def _on_torrent_finished_event(self, torrent_id):
         log.debug('Handler for TorrentFinishedEvent called for CORE')
         torrent = component.get('TorrentManager')[torrent_id]
-        torrent_status = torrent.get_status({})
+        torrent_status = torrent.get_status(['name', 'num_files'])
         # Email
         subject = _('Finished Torrent "%(name)s"') % torrent_status
         message = (
Post Reply