Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcloud dev_appserver.py error while starting Dart Managed VM

I configured a Dart Managed VM for AppEngine like described on the tutorial. It is outdated and still uses the now removed gcloud preview app run instead of dev_appserver.py. I found other people using the dev_appserver.py succesfully for Dart VMs however, but I get the following error:

$ dev_appserver.py app.yaml --runtime custom
INFO     2015-12-11 12:19:50,907 application_configuration.py:431] No version specified. Generated version id: 20151211t121950
INFO     2015-12-11 12:19:50,908 devappserver2.py:769] Skipping SDK update check.
INFO     2015-12-11 12:19:50,939 api_server.py:205] Starting API server at: http://localhost:36858
INFO     2015-12-11 12:19:50,951 api_server.py:648] Applying all pending transactions and saving the datastore
INFO     2015-12-11 12:19:50,951 api_server.py:651] Saving search indexes
Traceback (most recent call last):
  File "/opt/google/cloud-sdk/platform/google_appengine/dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "/opt/google/cloud-sdk/platform/google_appengine/dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
  File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1040, in <module>
    main()
  File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 1033, in main
    dev_server.start(options)
  File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 824, in start
    self._dispatcher.start(options.api_host, apis.port, request_data)
  File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/dispatcher.py", line 194, in start
    _module.start()
  File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1548, in start
    self._add_instance()
  File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/module.py", line 1700, in _add_instance
    expect_ready_request=True)
  File "/opt/google/cloud-sdk/platform/google_appengine/google/appengine/tools/devappserver2/custom_runtime.py", line 83, in new_instance
    assert self._runtime_config_getter().custom_config.custom_entrypoint
AssertionError

My Dockerfile is in place and app.yaml is correct. I created a sample Dart AppEngine project in IntelliJ and checked the contents of the created files with the tutorial.

This post from the e-mail list suggest to use the --custom_entrypoint option. I tried that, but got this error message. It seems like the port is being claimed by the appserver before the Dart entrypoint is called.

$ dev_appserver.py app.yaml --custom_entrypoint "dart bin/server.dart --port=8080"
INFO     2015-12-11 12:41:13,334 application_configuration.py:431] No version specified. Generated version id: 20151211t124113
INFO     2015-12-11 12:41:13,334 devappserver2.py:769] Skipping SDK update check.
INFO     2015-12-11 12:41:13,363 api_server.py:205] Starting API server at: http://localhost:44617
INFO     2015-12-11 12:41:13,375 dispatcher.py:197] Starting module "default" running at: http://localhost:8080
INFO     2015-12-11 12:41:13,376 admin_server.py:116] Starting admin server at: http://localhost:8000
Unhandled exception:
SocketException: Failed to create server socket (OS Error: Address already in use, errno = 98), address = 0.0.0.0, port = 8080
#0      _NativeSocket.bind.<anonymous closure> (dart:io-patch/socket_patch.dart:494)
#1      _rootRunUnary (dart:async/zone.dart:914)
#2      _CustomZone.runUnary (dart:async/zone.dart:810)
#3      _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:502)
#4      _Future._propagateToListeners (dart:async/future_impl.dart:585)
#5      _Future._completeWithValue (dart:async/future_impl.dart:376)
#6      _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:430)
#7      _rootRun (dart:async/zone.dart:907)
#8      _CustomZone.run (dart:async/zone.dart:802)
#9      _CustomZone.bindCallback.<anonymous closure> (dart:async/zone.dart:735)
#10     _microtaskLoop (dart:async/schedule_microtask.dart:43)
#11     _microtaskLoopEntry (dart:async/schedule_microtask.dart:52)
#12     _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:96)
#13     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:151)
^CTraceback (most recent call last):
  File "/opt/google/cloud-sdk/bin/dev_appserver.py", line 35, in <module>
    main()
  File "/opt/google/cloud-sdk/bin/dev_appserver.py", line 29, in main
    os.path.join('platform', 'google_appengine'), 'dev_appserver.py', *args)
  File "/opt/google/cloud-sdk/bin/bootstrapping/bootstrapping.py", line 45, in ExecutePythonTool
    execution_utils.ArgsForPythonTool(_FullPath(tool_dir, exec_name), *args))
  File "/opt/google/cloud-sdk/bin/bootstrapping/bootstrapping.py", line 86, in _ExecuteTool
    execution_utils.Exec(args + sys.argv[1:], env=_GetToolEnv())
  File "/opt/google/cloud-sdk/lib/googlecloudsdk/core/execution_utils.py", line 209, in Exec
INFO     2015-12-11 12:41:37,298 shutdown.py:45] Shutting down.
    ret_val = p.wait()
  File "/usr/lib64/python2.7/subprocess.py", line 1384, in wait
INFO     2015-12-11 12:41:37,298 api_server.py:648] Applying all pending transactions and saving the datastore
    pid, sts = _eintr_retry_call(os.waitpid, self.pid, 0)
  File "/usr/lib64/python2.7/subprocess.py", line 476, in _eintr_retry_call
    return func(*args)
KeyboardInterruptINFO     2015-12-11 12:41:37,298 api_server.py:651] Saving search indexes
like image 438
Steven Roose Avatar asked Nov 08 '22 23:11

Steven Roose


1 Answers

The tutorial is outdated and you can no longer do this.

The reason why is that you are using a custom runtime (the app.yaml in the tutorial has runtime: custom).

Custom runtimes can no longer be run on the development server!!! (see this answer)

It is possible to run the app, but you will have to deploy to App Engine servers.

like image 132
user2771609 Avatar answered Nov 14 '22 22:11

user2771609