Page 1 of 1

Socket Error

Posted: December 30th, 2012, 2:57 am
by b230614
Hello all

After starting up my computer today I noticed SAB did not start. After re-installing and altering different settings I still am unable to get SAB working again.

The following output is the result of trying to start SAB.

Code: Select all

[b230614@arch ~]$ sabnzbd
Traceback (most recent call last):
  File "/opt/sabnzbd/SABnzbd.py", line 66, in <module>
    import sabnzbd
  File "/opt/sabnzbd/sabnzbd/__init__.py", line 73, in <module>
    from sabnzbd.nzbqueue import NzbQueue
  File "/opt/sabnzbd/sabnzbd/nzbqueue.py", line 41, in <module>
    import sabnzbd.downloader
  File "/opt/sabnzbd/sabnzbd/downloader.py", line 33, in <module>
    from sabnzbd.newswrapper import NewsWrapper, request_server_info
  File "/opt/sabnzbd/sabnzbd/newswrapper.py", line 449, in <module>
    _EXTERNAL_IPV6 = test_ipv6()
  File "/opt/sabnzbd/sabnzbd/newswrapper.py", line 435, in test_ipv6
    socket.IPPROTO_IP, socket.AI_CANONNAME)
socket.error: [Errno 0] Error
Also when trying to diagnosis SAB, SAB will randomly decide to start. But then fails to start when trying to replicate what I just changed.

Thanks in advance for the help.

Re: Socket Error

Posted: December 30th, 2012, 3:28 am
by sander
I see "/opt", so you're running SABnzbd on a NAS or so?

On that device, can you run this and post the output here:

Code: Select all

sander@R540:~$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getaddrinfo('www.google.com', 80, socket.AF_INET6, socket.SOCK_STREAM,socket.IPPROTO_IP, socket.AI_CANONNAME)
[(10, 1, 6, 'www.google.com', ('2a00:1450:400c:c03::63', 80, 0, 0))]
>>> 
sander@R540:~$ 
BTW:
the source code says this:

Code: Select all

def test_ipv6():
    """ Check if external IPv6 addresses are reachable """
    # Use google.com to test IPv6 access
    try:
        info = socket.getaddrinfo('www.google.com', 80, socket.AF_INET6, socket.SOCK_STREAM,
                                  socket.IPPROTO_IP, socket.AI_CANONNAME)
    except socket.gaierror:
        return False
so I guess a workaround is to just remove "socket.gaierror" from the code and then run again ... Worth a try?

Re: Socket Error

Posted: December 30th, 2012, 3:45 am
by b230614
sander wrote:I see "/opt", so you're running SABnzbd on a NAS or so?

On that device, can you run this and post the output here:

Code: Select all

sander@R540:~$ python
Python 2.7.3 (default, Sep 26 2012, 21:51:14) 
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getaddrinfo('www.google.com', 80, socket.AF_INET6, socket.SOCK_STREAM,socket.IPPROTO_IP, socket.AI_CANONNAME)
[(10, 1, 6, 'www.google.com', ('2a00:1450:400c:c03::63', 80, 0, 0))]
>>> 
sander@R540:~$ 
BTW:
the source code says this:

Code: Select all

def test_ipv6():
    """ Check if external IPv6 addresses are reachable """
    # Use google.com to test IPv6 access
    try:
        info = socket.getaddrinfo('www.google.com', 80, socket.AF_INET6, socket.SOCK_STREAM,
                                  socket.IPPROTO_IP, socket.AI_CANONNAME)
    except socket.gaierror:
        return False
so I guess a workaround is to just remove "socket.gaierror" from the code and then run again ... Worth a try?
No it is not a NAS.

Code: Select all

[b230614@arch ~]$ python
Python 3.3.0 (default, Dec 22 2012, 21:02:07) 
[GCC 4.7.2] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.getaddrinfo('www.google.com', 80, socket.AF_INET6, socket.SOCK_STREAM,socket.IPPROTO_IP, socket.AI_CANONNAME)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 0] Error
>>> 
The 'workaround' seemed to do the trick.

Also thanks for the help.

EDIT: Worked for the first start up then failed.
EDIT2: SAB added back what I removed, I changed the permissions of the file so SAB can no longer change things. Seems all good now, thanks again for the help.

Re: Socket Error

Posted: December 30th, 2012, 4:20 am
by sander
You're welcome. Good that it works. A few remarks:

- AFAIK SAB does not change its source code. Maybe the file was in use while you edited it?
- SAB only uses Python 2.x. So for a fully correct test, start python 2 ("python2" on your system?). Can you run the test again, just to be sure?

Re: Socket Error

Posted: December 30th, 2012, 5:04 am
by b230614
sander wrote:You're welcome. Good that it works. A few remarks:

- AFAIK SAB does not change its source code. Maybe the file was in use while you edited it?
- SAB only uses Python 2.x. So for a fully correct test, start python 2 ("python2" on your system?). Can you run the test again, just to be sure?
Most likely it was opened, as for test it produces the same results as with 'python'.

Re: Socket Error

Posted: December 30th, 2012, 7:07 am
by shypike
Testing for specific error codes in a multi-platform app is a risk.
I'll change the code accordingly.