This is just a post for the record for myself since I didn’t fully understand every part of the issue and most recent computers all have IPv6 enabled.
Just a day or two ago, I upgraded Google App Engine to 1.7.7 from 1.7.6 and it threw this error:
~/p/yjl.im [hg:default] $ make run google_appengine/dev_appserver.py --enable_sendmail yes src Traceback (most recent call last): File "google_appengine/dev_appserver.py", line 193, in <module> _run_file(__file__, globals()) File "google_appengine/dev_appserver.py", line 189, in _run_file execfile(script_path, globals_) File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 662, in <module> main() File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 655, in main dev_server.start(options) File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 626, in start apis.start() File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/api_server.py", line 151, in start super(APIServer, self).start() File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 289, in start server.start() File "/home/livibetter/p/google_appengine/google/appengine/tools/devappserver2/wsgi_server.py", line 190, in start socket.SOCK_STREAM, 0, socket.AI_PASSIVE) TypeError: getaddrinfo() argument 1 must be string or None Exception in thread Thread-4 (most likely raised during interpreter shutdown): Traceback (most recent call last): make: *** [run] Error 1
At first, I thought maybe some system updates interferred, so I checked logs, Python was untoched nor any system packages. There was no installs or uninstalls. I searched for issues, documentations, discussions, Stack Overflow, not a single entry posted after the release of 1.7.7 having the same error message I got.
Finally, I printed out the host and port to see what’s going on, they had some unusual values:
10 '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
If compared with the following code:
socket.getaddrinfo('localhost', 0, socket.AF_UNSPEC, socket.SOCK_STREAM, 0, socket.AI_PASSIVE) [(2, 1, 6, '', ('127.0.0.1', 0)), (10, 1, 6, '', (10, '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'))]
You can see where the values came from. According to Python socket:
[…] (results may differ on your system if IPv6 isn’t enabled):
and getaddrinfo(3):
[…] and no matching IPv6 addresses could be found, then return IPv4-mapped IPv6 addresses in the list pointed to by res. […]
I think that 14 bytes of all 0s might have something to do with “IPv4-mapped IPv6 address” since I don’t have IPv6 enabled. I feel the values of Python’s socket.getaddinfo look like an erroneous result.
At this moment, just a quick workaround, I replaced AF_UNSPEC with AF_INET in line 276 for IPv4 only. I think this sort of counts as a bug, but I am not sure if it is worth to report and to be patched.
This could be a sign that it’s time for me to migrate to IPv6, I now have added ipv6 USE flag added in make.conf. I will let packages slowly being built with IPv6 support.
Please file a bug. http://code.google.com/p/googleappengine/issues
ReplyDeleteIPv6 should work with gae sockets.
I don't think you read my post right. The problem is not GAE's IPv6 support. But the values returned from Python's getaddrinfo when IPv6 is disabled, they don't read like a valid IPv6 address. Since they don't, you can't expect GAE can use that invalid address correctly.
ReplyDeleteSo, I said I am not sure if it's worth to report, it's because partly I don't think that's a GAE bug but a Python bug. However, since the Python socket documentation doesn't specify what exactly the returned result looks like when IPv6 is disabled and I don't have any knowledge about IPv6, therefore I can't be certain the values are incorrect.
Moreover, even IPv4 still remains strong and IPv6 most likely are enabled on most computers regardless the OSes. So, I feel it's no need to file a report, I might be only a few people in this world who don't have IPv6 enabled.