Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a7874])

Report & discuss bugs found in SABnzbd
Forum rules
Help us help you:
  • Are you using the latest stable version of SABnzbd? Downloads page.
  • Tell us what system you run SABnzbd on.
  • Adhere to the forum rules.
  • Do you experience problems during downloading?
    Check your connection in Status and Interface settings window.
    Use Test Server in Config > Servers.
    We will probably ask you to do a test using only basic settings.
  • Do you experience problems during repair or unpacking?
    Enable +Debug logging in the Status and Interface settings window and share the relevant parts of the log here using [ code ] sections.
zacharylm
Newbie
Newbie
Posts: 6
Joined: December 9th, 2016, 3:54 pm

Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a7874])

Post by zacharylm »

Since the last update, SAB has started to fail when trying to send a notification via Pushbullet. Other applications (e.g. Couchpotato, Sonarr) have no issue doing the same. Below is the pertinent portion of the log. Please let me know if any other info is needed.

Code: Select all

2016-12-09 12:46:49,368::INFO::[api:792] Sending Pushbullet notification
2016-12-09 12:46:49,468::WARNING::[notifier:489] Failed to send pushbullet message
2016-12-09 12:46:49,469::INFO::[notifier:490] Traceback:
Traceback (most recent call last):
  File "/usr/share/sabnzbdplus/sabnzbd/notifier.py", line 481, in send_pushbullet
    'Content-type': 'application/json'})
  File "/usr/lib/python2.7/httplib.py", line 1017, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1051, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1013, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 864, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 826, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1220, in connect
    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
  File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 243, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake
    self._sslobj.do_handshake()
SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
User avatar
safihre
Administrator
Administrator
Posts: 5366
Joined: April 30th, 2015, 7:35 am
Contact:

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by safihre »

Looking up this message it seems to have to do something with an TLS problem.
We just use the build-in SSL provider from Python, nothing special really and nothing has changed between versions.
So I think it's something with Pushbullet's API certificate, but I can't tell you what exactly..
If you like our support, check our special newsserver deal or donate at: https://sabnzbd.org/donate
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

As you're on Ubuntu, let's analyze your setup with this small script that does about the same as SABnzbd itself:

Code: Select all

import httplib, urllib, json

conn = httplib.HTTPSConnection('api.pushbullet.com:443')
conn.request('POST', '/v2/pushes', json.dumps({'type': 'note','device': "bla",'title': "title",'body': "msg"}),headers={'Authorization': 'Bearer ' + "dddd8d88d8d8", 'Content-type': 'application/json'})
res = conn.getresponse()

print res.status
print res.read()

Result on my Ubuntu:

Code: Select all

$ python test-pushbullet.py 
401
{"error":{"code":"invalid_access_token","type":"invalid_request","message":"Access token is missing or invalid.","cat":"(=^・ω・^)y="},"error_code":"invalid_access_token"}
So, a correct 401. No Ugly SSL / EOL message.

Please post back your result.
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

@zacharylm ... follow up please ....
zacharylm
Newbie
Newbie
Posts: 6
Joined: December 9th, 2016, 3:54 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by zacharylm »

Apologies for the late response, apparently I need to check my forum setting as I never received an email notifying me of a reply to my post. Anyhoo, here's the result:

Code: Select all

Traceback (most recent call last):
  File "sabtest.py", line 4, in <module>
    conn.request('POST', '/v2/pushes', json.dumps({'type': 'note','device': "bla",'title': "title",'body': "msg"}),headers={'Authorization': 'Bearer ' + "dddd8d88d8d8", 'Content-type': 'application/json'})
  File "/usr/lib/python2.7/httplib.py", line 1017, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1051, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1013, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 864, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 826, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1220, in connect
    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
  File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 243, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

OK, good that you follow up.

The result of the python script shows your Ubuntu / python / SSL setup has a problem. The problem is not in SABnzbd; you can generate the problem with a few lines of plain python code, without any SABnzbd involved.

Googling "ssl.SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol" does not immediately make clear what is going on ... It could be related to SSL 2/3: python tries that first, but api.pushbullet.com does only support TLS 1 and higher (which is a good thing)

Which Ubuntu are you running? Fully updated?
zacharylm
Newbie
Newbie
Posts: 6
Joined: December 9th, 2016, 3:54 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by zacharylm »

Running 14.04.5 LTS (GNU/Linux 4.4.0-53-generic x86_64). As far as apt is telling me, and save for doing the release upgrade to 16.04, I'm up-to-date.
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

zacharylm wrote:Running 14.04.5 LTS (GNU/Linux 4.4.0-53-generic x86_64). As far as apt is telling me, and save for doing the release upgrade to 16.04, I'm up-to-date.
I tried on my Ubuntu 14.04.5 (instead of my 16.04 as I did before) and ... ouch:

Code: Select all

sander@haring:~$ python test-pushbullet-1.py 
Traceback (most recent call last):
  File "test-pushbullet-1.py", line 4, in <module>
    conn.request('POST', '/v2/pushes', json.dumps({'type': 'note','device': "bla",'title': "title",'body': "msg"}),headers={'Authorization': 'Bearer ' + "dddd8d88d8d8", 'Content-type': 'application/json'})
  File "/usr/lib/python2.7/httplib.py", line 1017, in request
    self._send_request(method, url, body, headers)
  File "/usr/lib/python2.7/httplib.py", line 1051, in _send_request
    self.endheaders(body)
  File "/usr/lib/python2.7/httplib.py", line 1013, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 864, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 826, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 1220, in connect
    self.sock = ssl.wrap_socket(sock, self.key_file, self.cert_file)
  File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
    ciphers=ciphers)
  File "/usr/lib/python2.7/ssl.py", line 243, in __init__
    self.do_handshake()
  File "/usr/lib/python2.7/ssl.py", line 405, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [Errno 8] _ssl.c:510: EOF occurred in violation of protocol
Same problem :-(
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

Even with this 3-liner I get the error on my Ubuntu 14.04.5 with api.pushbullet.com (not with other HTTPS sites):

Code: Select all

import urllib2
response = urllib2.urlopen('https://api.pushbullet.com/')
html = response.read()
Result:

Code: Select all

$ python urllib2-2.py
Traceback (most recent call last):
  File "urllib2-2.py", line 2, in <module>
    response = urllib2.urlopen('https://api.pushbullet.com/')
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 8] _ssl.c:510: EOF occurred in violation of protocol>
zacharylm
Newbie
Newbie
Posts: 6
Joined: December 9th, 2016, 3:54 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by zacharylm »

Hmmm. Well, I'm glad that it can be reproduced, but it sucks for the big picture. Also interesting that SABnzbd is the only program on my box that seems to be affected. Went back and was still able to do test notifications from Sonarr and CouchPotato (can't seem to find a way to test Headphones, though) so I wonder what is different in their implementations.
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

It seems to be related to the version of Python:


Python 2.7.11 on Ubuntu 14.04.5 is OK:

Code: Select all

sander@haring:~/pushbullet-test$ /opt/python2711/bin/python urllib2-2.py
{"cat":"(=^.^=)","happy_to_see_you":true,"message":"Welcome to the Pushbullet API!"}

Python 2.7.6 on Ubuntu 14.04.5 is not OK:

Code: Select all

sander@haring:~/pushbullet-test$ python urllib2-2.py
Traceback (most recent call last):
  File "urllib2-2.py", line 2, in <module>
    response = urllib2.urlopen('https://api.pushbullet.com/')
  File "/usr/lib/python2.7/urllib2.py", line 127, in urlopen
    return _opener.open(url, data, timeout)
  File "/usr/lib/python2.7/urllib2.py", line 404, in open
    response = self._open(req, data)
  File "/usr/lib/python2.7/urllib2.py", line 422, in _open
    '_open', req)
  File "/usr/lib/python2.7/urllib2.py", line 382, in _call_chain
    result = func(*args)
  File "/usr/lib/python2.7/urllib2.py", line 1222, in https_open
    return self.do_open(httplib.HTTPSConnection, req)
  File "/usr/lib/python2.7/urllib2.py", line 1184, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [Errno 8] _ssl.c:510: EOF occurred in violation of protocol>
sander@haring:~/pushbullet-test$ 
sander@haring:~/pushbullet-test$ 
sander@haring:~/pushbullet-test$ python -V
Python 2.7.6
The same error as you got;

Code: Select all

[Errno 8] _ssl.c:510: EOF occurred in violation of protocol>
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

zacharylm wrote:Hmmm. Well, I'm glad that it can be reproduced, but it sucks for the big picture. Also interesting that SABnzbd is the only program on my box that seems to be affected. Went back and was still able to do test notifications from Sonarr and CouchPotato (can't seem to find a way to test Headphones, though) so I wonder what is different in their implementations.
And Sonarr and CouchPotato run on the same Ubuntu 14.04, with the same Python?

I checked CouchPotato, and it uses the same url

Code: Select all

 url = 'https://api.pushbullet.com/v2/%s'
so there is no difference there. :-(
zacharylm
Newbie
Newbie
Posts: 6
Joined: December 9th, 2016, 3:54 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by zacharylm »

As far as I can tell, yeah. I double-checked the init scripts in /defaults/etc and I don't seem to be calling out a different version of Python. Is there a better way to be sure?
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

Too bad: I tried plain HTTP as a workaround, but:

Code: Select all

2016-12-12 15:19:44,098::INFO::[api:797] Sending Pushbullet notification
2016-12-12 15:19:45,848::ERROR::[notifier:485] Bad response from Pushbullet (403): {"error":{"code":"invalid_request","type":"invalid_request","message":"This server is only accessible over HTTPS.","cat":"(=^â¥^=)"},"error_code":"invalid_request"}
... so alas HTTP is not a workaround.

EDIT:

I looked around, but I don't know how to solve this. So, workaround is to install Python 2.7.9 or higher on a Ubuntu 14.04, and use that.
User avatar
sander
Release Testers
Release Testers
Posts: 8832
Joined: January 22nd, 2008, 2:22 pm

Re: Pushbullet Notifications Failing (Ubuntu, v1.1.1 [33a787

Post by sander »

Good news: I got it working on my Ubuntu 14.04, both standalone and in SAB.

Standalone ... please fill out your pushbullet apikey and then test:

Code: Select all

import requests, json
device = "bla"
title = "my title"
msg = "my message"
apikey = "o.kdLtzjXCMzblblabla"   # Fill this out!!
if True:
        data_send = {"type": "note", "device": device, "title": title, "body": msg}
        res = requests.post('https://api.pushbullet.com/v2/pushes', data=json.dumps(data_send),
                headers={'Authorization': 'Bearer ' + apikey, 'Content-Type': 'application/json'})
        print res.status_code
If that works, I have a solution for SAB on with python 2.7.6.
Post Reply