GAE套接字API错误 - ApplicationError:4未知错误

时间:2014-11-13 08:14:15

标签: sockets google-app-engine

我们有一个app引擎cron,可以使用dnspython检查多个DNS服务器的活跃度。直到[2014年11月12日:13:28:12 -0800](大约12小时前)它一直没有问题,100%的时间开始失败,其中包括:

DNS Lookup failed: 'ApplicationError: 4 Unknown error.'.  Traceback (most recent call last):
  File ".../handlers/tasks.py", line 150, in _checkDNSServer
    answers = resolver.query(domain, 'A', source='')
  File "lib/dns/resolver.py", line 830, in query
    source_port=source_port)
  File "lib/dns/query.py", line 213, in udp
    s.bind(source)
  File "/base/data/home/runtimes/python27/python27_dist/lib/python2.7/socket.py", line 222, in meth
    return getattr(self._sock,name)(*args)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py", line 660, in bind
    self._CreateSocket(bind_address=address)
  File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/api/remote_socket/_remote_socket.py", line 611, in _CreateSocket
    raise _SystemExceptionFromAppError(e)
ApplicationError: ApplicationError: 4 Unknown error.

有问题的代码非常简单......

def _checkDNSServer(self, ip):
    """ Return true if the server is up and responds within 1 second.
        False the server is down or responded slowly
    """
    domain = 'www.testdomain.com'
    resolver = dns.resolver.Resolver()
    resolver.nameservers = [ip]

    starttime = datetime.now()
    try:
        answers = resolver.query(domain, 'A', source='')
        duration = datetime.now() - starttime

        logging.debug("DNS Lookup Time %s" % duration)
        # Max delay of 1 second
        if duration > timedelta(seconds=1):
            return False

        return True
    except Exception as e:
        tb = traceback.format_exc()
        logging.error("DNS Lookup failed: '%s'.  %s", e, tb)
        return False
  • 代码继续在本地开发服务器上运行
  • 结算已启用
  • 配额已足够
  • 在出现错误之前/之后,对应用引擎发布版本(1.9.16)没有任何更改
  • 目标服务器正常并且响应正常

建议?

1 个答案:

答案 0 :(得分:0)

似乎这是一个短暂的问题,现在已经解决了。