Skip to content
This repository has been archived by the owner on Sep 14, 2021. It is now read-only.

daemon + remote debugging : suspend support? #229

Closed
renaudcerrato opened this issue Feb 11, 2016 · 6 comments
Closed

daemon + remote debugging : suspend support? #229

renaudcerrato opened this issue Feb 11, 2016 · 6 comments

Comments

@renaudcerrato
Copy link

I'm using Idea Intellij CE, and I'm struggling to setup a debug configuration: I'd like the development server to wait for my debugger to connect - but it seems the daemon property on appengine is not respected when suspend=y:

image

appengine {
    daemon = true
    jvmFlags = ['-Xdebug', '-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000']
...

When I run the gradle task, using the setup above (suspend=y), the task never exits - which is probably because of the JVM waiting for the debugger. IMO, if daemon = true the JVM should be started from a forked process instead of detaching it from the JVM...

Am I missing something?

@loosebazooka
Copy link
Contributor

I think I understand what you're saying. The jvm flags are used by the kickstart program that starts up the dev appserver process, see :


and
https://cloud.google.com/appengine/docs/java/tools/javadoc/com/google/appengine/tools/KickStart

Yeah your problem is that backend:appengineRun will never exit in your setup. This is because the process launching kickstarter is trying not to move forward before the devappserver is up. I believe the original author's intention was to only move forward (specifically for functional tests) once the server was up and so there's some semaphoring going on there. There's not particularly a good way to deal with this without breaking the functionality of the appengineFunctionalTest task.

You can try creating a generic java run configuration that emulates what kickstart is doing and use that to launch your devappserver instead of the gradle runner.

It's not clear to me though why you want daemon = true on the dev_appserver though.

@renaudcerrato
Copy link
Author

Thanks for the answer. Since i'm telling my debug configurations to run the gradle task appengineRun beforehand, I need daemon = true or the configuration will wait indefinitely for that task to end...

Didn't tried using a java task - but sounds like the only possible solution.

@loosebazooka
Copy link
Contributor

Oh yeah of course. Your other option is two steps (two run configs launched one after the other)?

@renaudcerrato
Copy link
Author

Yep, I tried this one, but the appengineRun as configuration didn't exit neither, probably because that's recognized as a gradle task...

Didn't succeed yet to find the correct options to run it as Java.

@loosebazooka
Copy link
Contributor

I would do something like the kickstart page describes

https://cloud.google.com/appengine/docs/java/tools/javadoc/com/google/appengine/tools/KickStart

 java -cp <an_absolute_path>/lib/appengine-tools-api.jar \
   -agentlib:jdwp=transport=dt_socket,server=y,address=8000 \ <-- I think running in debug from the IDE will automatically do this for you
   com.google.appengine.tools.development.DevAppServerMain \
   --address=localhost --port=5005 <an_absolute_path>/appDir

appengine-tools-api.jar is in <user-home>/.gradle/appengine-sdk/appengine-java-sdk-1.9.XX/lib
app-dir is in <project-directory>/build/exploded-app

@renaudcerrato
Copy link
Author

Damned, I missed it! Many thanks for the directions!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants