7

I'm using GAE Python 2.7 with the local development server. I have configured a backend

backends:
- name: worker
  class: B1
  options: dynamic

and I'm using the default taskqueue. Everything works fine and the backend and taskqueue are visible at the SDK console. Also the local development work starts without any errors:

Multiprocess Setup Complete:
Remote API Server [http://localhost:9200]
App Instance [http://localhost:9000]
Backend Instance: worker.0 [http://localhost:9100]
Backend Balancer: worker [http://localhost:9199]

BUT if I try to address the backend via a task

taskqueue.add(url='/xyz', method='POST', target='worker', params={'a':'b'})

this error raises:

ERROR An error occured while sending the task "task1" (Url: "/backend/languages/create_database/") in queue "default". Treating as a task error.
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/api/taskqueue/taskqueue_stub.py", line 1884, in ExecuteTask
    connection.endheaders()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 937, in endheaders
    self._send_output(message_body)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 797, in _send_output
    self.send(msg)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 759, in send
    self.connect()
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 740, in connect
    self.timeout, self.source_address)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 553, in create_connection
    for res in getaddrinfo(host, port, 0, SOCK_STREAM):
gaierror: [Errno 8] nodename nor servname provided, or not known

I'm using 'localhost' and can't see any reason why it fails. Some ideas / solutions? Any startup-parameter missing or somethin like that?

Thanks

2
  • Can you edit your taskqueue.add statement? Commented Nov 7, 2012 at 15:43
  • Of course I could execute the statement without any "target", it's running without any errors. But my goal is the execution on the backend server :-) Commented Nov 8, 2012 at 10:57

2 Answers 2

8

It's a bug in taskqueue.py, it misses a case to distinguish between production and the development environment.

In production, it does the right thing by concatenating the target with the hostname.

In development, that doesn't work and will produce the error you reported when trying to resolve worker.localhost address.

Instead it should set the task host to the ip:port dev_appserver is running the backend on.

There is already a bug in the public issue tracker that has been escalated to the engineering team.

Feel free to star it if you want to be notified about updates.

Sign up to request clarification or add additional context in comments.

3 Comments

So any fix for that? Or we can't develop anymore on the dev server?
You should star code.google.com/p/googleappengine/issues/detail?id=5105 to be notified about update regarding this issue.
@JimmyKane, please see below a small workaround that helps me to debug backend services locally.
1

There is one workaround that helps me debug locally:

if os.environ['SERVER_SOFTWARE'].startswith('Development'):
    taskqueue.add(url='/task', params={...})
else:    
    taskqueue.add(url='/task', params={...}, target='backendservername')

In this case, if we debug locally, we run the task in the regular task queue. If we put this code into App Engine it will start the task using a backend server.

4 Comments

Are you specifying the PORT number using this if statement?
@Andrew, no, I don't specify any port numbers.
In that case, i don't entirely understand the solution. In the example above, the task will still be directed to port 80 (as opposed to 8080). I though you were specifying the port via target='localhost:8080', but you're not taking this approach... I guess I don't understand how "taskqueue.add(url='/task', params={...})" solves this issue.
@Andrew, it is not a solution. It is a workaround. The main idea in this code that we don't use a backend at all. We use regular task queue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.