3

I am trying to debug CDAP code and plugin code

I have tried several options to run the CDAP sandbox:

https://docs.cask.co/cdap/5.1.0-SNAPSHOT/en/developer-manual/getting-started/sandbox/docker.html

The sandbox runs and the stout logs say port 5005 is exposed for debugging

Starting CDAP Sandbox ...Listening for transport dt_socket at address: 5005

docker ps has two other ports: 0.0.0.0:11011->11011/tcp, 0.0.0.0:11015->11015/tcp cdap-sandbox

When I configure IntelliJ debugger to 11015 it seems to have no problem but breakpoints don't catch the running of code.

I tried running CDAP sandbox on virtualbox and using 192.168.99.100 but I still cant catch breakpoints with the remote debugger

I also tried adding 5005 to exposed docker ports 0.0.0.0:5005->5005/tcp and configuring intellij to do the same. Intellij was not able to connect to remote 5005

How do I debug cdap sandbox with intellij?

Rubber Duck
  • 3,673
  • 3
  • 40
  • 59

3 Answers3

3

Problem is with the functions.sh file in bin directory. By default it binds the listening port to localhost.

To fix it:

Find the line:

"CDAP_SDK_OPTS+=" -agentlib:jdwp=transport=dt_socket,address=localhost:${__port},server=y,suspend=n"

and change it to something like (remove localhost:):

"CDAP_SDK_OPTS+=" -agentlib:jdwp=transport=dt_socket,address=${__port},server=y,suspend=n"

Reishin
  • 1,854
  • 18
  • 21
  • I haven't touched CDAP in a long while and so can't evaluate your answer. – Rubber Duck Oct 17 '19 at 16:51
  • 1
    added a link to github source, so it would be more simple to understand – Reishin Oct 18 '19 at 19:56
  • While I'm not the original asker -- this was the missing piece for me. After editing that functions.sh file, I was able to connect my remote debugger into a docker container. – istrupin Aug 19 '20 at 17:48
1

Have you started CDAP with --enable-debug flag?

Our documentation here will help you with starting CDAP in debug mode.

Additionally you might find our Testing and Debugging documentation helpful.

  • I read the documentation it the link in my question. The debugger doesn't attach. The only way I could debug was using tests. – Rubber Duck Nov 01 '18 at 16:15
1
  • Start the CDAP sandbox in debug mode.
bin/cdap sandbox start --enable-debug
  • In intelliJ goto Run -> Edit Configurations -> Add New Configuration -> Remote
  • Specify the Configuration name, enter the host and port(5005 for debugging cdap).
  • Select your maven module in Use module classpath input configuration and hit Apply

  • Now to debug hit the debug button and you are good to go.

Neelesh
  • 666
  • 6
  • 17