Handle exceptions from python without ipv6 support #952

Merged
g1itch merged 1 commits from ipv6 into v0.6 2018-03-22 16:18:00 +01:00
g1itch commented 2017-02-23 19:42:41 +01:00 (Migrated from github.com)

Hello.

PyBitmessage shown many exceptions on my linux laptop because of python installed without ipv6 support. I tried to handle them all properly. The only question that remains is the log message "Peer host is None!" from line 53 in src/class_outgoingSynSender.py.

Hello. PyBitmessage shown many exceptions on my linux laptop because of python installed without ipv6 support. I tried to handle them all properly. The only question that remains is the log message "Peer host is None!" from line 53 in src/class_outgoingSynSender.py.
PeterSurda commented 2017-02-23 22:35:33 +01:00 (Migrated from github.com)

I'm now in feature freeze mode for 0.6.2 so I can't promise this will make it into 0.6.2 because I need to test it and I don't know if I have time. Please follow the contribution guidelines: https://bitmessage.org/wiki/Contribute, you're missing a PGP signature that is associated with your github account. Without the signature, I'll have to resign it with mine and then I'll be the committer and you won't receive a tip.

I'm now in feature freeze mode for 0.6.2 so I can't promise this will make it into 0.6.2 because I need to test it and I don't know if I have time. Please follow the contribution guidelines: https://bitmessage.org/wiki/Contribute, you're missing a PGP signature that is associated with your github account. Without the signature, I'll have to resign it with mine and then I'll be the committer and you won't receive a tip.
PeterSurda (Migrated from github.com) reviewed 2017-02-23 22:36:13 +01:00
PeterSurda (Migrated from github.com) commented 2017-02-23 22:36:13 +01:00

Isn't this covered by errno.EAFNOSUPPORT?

Isn't this covered by errno.EAFNOSUPPORT?
PeterSurda commented 2017-02-23 22:36:44 +01:00 (Migrated from github.com)

Also, please tell me which linux distro has ipv6 disabled so I can test it.

Also, please tell me which linux distro has ipv6 disabled so I can test it.
g1itch commented 2017-02-23 22:39:26 +01:00 (Migrated from github.com)

In gentoo you can disable ipv6 by portage use-flag (USE="-ipv6").

In gentoo you can disable ipv6 by portage use-flag (USE="-ipv6").
PeterSurda (Migrated from github.com) reviewed 2017-02-23 22:41:42 +01:00
PeterSurda (Migrated from github.com) commented 2017-02-23 22:41:42 +01:00

Landscape.io complains here, it should be just a "," rather than "%".

Landscape.io complains here, it should be just a "," rather than "%".
g1itch (Migrated from github.com) reviewed 2017-02-23 22:42:47 +01:00
g1itch (Migrated from github.com) commented 2017-02-23 22:42:47 +01:00

This article https://docs.python.org/2/library/socket.html#socket.error says socket.error may return string instead of errno and i've seen it.

This article https://docs.python.org/2/library/socket.html#socket.error says socket.error may return string instead of errno and i've seen it.
PeterSurda commented 2017-02-24 23:57:15 +01:00 (Migrated from github.com)

I don't think I'll have time to test it before 0.6.2 because I don't have a gentoo environment and no other VM without IPv6 support. Just hold on a week or two.

I don't think I'll have time to test it before 0.6.2 because I don't have a gentoo environment and no other VM without IPv6 support. Just hold on a week or two.
g1itch commented 2017-02-24 23:58:33 +01:00 (Migrated from github.com)

OK

OK
PeterSurda commented 2017-02-26 13:23:39 +01:00 (Migrated from github.com)

I actually had to do some other fixes which may have fixed this one too (apart from the string). I haven't tested it on a IPv4-only linux, but I tested it on OpenBSD which cannot open a socket for both IPv4 and IPv6 and it worked fine, it fell back to IPv4-only. Can you retry?

I actually had to do some other fixes which may have fixed this one too (apart from the string). I haven't tested it on a IPv4-only linux, but I tested it on OpenBSD which cannot open a socket for both IPv4 and IPv6 and it worked fine, it fell back to IPv4-only. Can you retry?
g1itch commented 2017-02-26 14:24:42 +01:00 (Migrated from github.com)

Nothing changed for me. With your recent code pybitmessage still works, but if I run it in terminal I can see the following exceptions:

Exception in thread singleListener:
Traceback (most recent call last):
  File "/usr/lib64/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib64/python2.7/site-packages/pybitmessage/class_singleListener.py", line 88, in run
    sock = self._createListenSocket(socket.AF_INET6)
  File "/usr/lib64/python2.7/site-packages/pybitmessage/class_singleListener.py", line 46, in _createListenSocket
    sock.bind((HOST, PORT))
  File "/usr/lib64/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: getsockaddrarg: bad family
CRITICAL - Critical error in a receiveDataThread: 
Trac
RITICAL - Critical error in a receiveDataThread: 
Traceback (most recent call last):
  File "/usr/lib64/python2.7/site-packages/pybitmessage/class_receiveDataThread.py", line 220, in processData
    self.recaddr(payload)
  File "/usr/lib64/python2.7/site-packages/pybitmessage/class_receiveDataThread.py", line 612, in recaddr
    hostStandardFormat = self._checkIPAddress(fullHost)
  File "/usr/lib64/python2.7/site-packages/pybitmessage/class_receiveDataThread.py", line 552, in _checkIPAddress
    hostStandardFormat = socket.inet_ntop(socket.AF_INET6, host)
ValueError: unknown address family 10
Nothing changed for me. With your recent code pybitmessage still works, but if I run it in terminal I can see the following exceptions: ``` Exception in thread singleListener: Traceback (most recent call last): File "/usr/lib64/python2.7/threading.py", line 801, in __bootstrap_inner self.run() File "/usr/lib64/python2.7/site-packages/pybitmessage/class_singleListener.py", line 88, in run sock = self._createListenSocket(socket.AF_INET6) File "/usr/lib64/python2.7/site-packages/pybitmessage/class_singleListener.py", line 46, in _createListenSocket sock.bind((HOST, PORT)) File "/usr/lib64/python2.7/socket.py", line 228, in meth return getattr(self._sock,name)(*args) error: getsockaddrarg: bad family ``` ``` CRITICAL - Critical error in a receiveDataThread: Trac RITICAL - Critical error in a receiveDataThread: Traceback (most recent call last): File "/usr/lib64/python2.7/site-packages/pybitmessage/class_receiveDataThread.py", line 220, in processData self.recaddr(payload) File "/usr/lib64/python2.7/site-packages/pybitmessage/class_receiveDataThread.py", line 612, in recaddr hostStandardFormat = self._checkIPAddress(fullHost) File "/usr/lib64/python2.7/site-packages/pybitmessage/class_receiveDataThread.py", line 552, in _checkIPAddress hostStandardFormat = socket.inet_ntop(socket.AF_INET6, host) ValueError: unknown address family 10 ```
PeterSurda commented 2017-02-26 14:27:12 +01:00 (Migrated from github.com)

Thanks for the feedback, I'll look at it after 0.6.2 as I have no way to test your patch on a IPv4 only system at the moment.

Thanks for the feedback, I'll look at it after 0.6.2 as I have no way to test your patch on a IPv4 only system at the moment.
g1itch commented 2018-03-16 15:32:03 +01:00 (Migrated from github.com)

One exception still exists. Another distro which can be configured without IPv6 support is openwrt.

One exception still exists. Another distro which can be configured without IPv6 support is openwrt.
PeterSurda commented 2018-03-16 15:55:22 +01:00 (Migrated from github.com)

Well it looks pretty straightforward.

Well it looks pretty straightforward.
PeterSurda (Migrated from github.com) approved these changes 2018-03-22 09:22:06 +01:00
MahendraNG (Migrated from github.com) approved these changes 2018-03-22 14:52:45 +01:00
This repo is archived. You cannot comment on pull requests.
No description provided.