Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Added the steps for debug java topologies #1404

Merged
merged 2 commits into from
Sep 23, 2016

Conversation

vidit-bhatia
Copy link
Contributor

No description provided.

@kramasamy
Copy link
Contributor

@lucperkins - can you review this PR please?

@lucperkins
Copy link
Contributor

I've performed a significant re-write of this section. Please re-submit with these changes:

7. Debugging Java topologies

The jar containing the code for building the topology, along with the spout and bolt
code, is deployed in the containers. A Heron Instance is started in each container, with each
Heron Instance responsible for running a bolt or a spout. One way to debug Java code is to write debug logs to the log files for tracking and debugging purposes.

Logging is the preferred mode for debugging as it makes it easer to find issues in both the short and long term in the topology. If you want to perform step-by-step debugging of a JVM
process, however, this can be achieved by enabling remote debugging for the Heron Instance.

Follow these steps to enable remote debugging:

  1. Add Java options to enable debugging on all the Heron Instances that will be started. This can be achieved by adding the options "agentlib:jdwp=transport=dt_socket,address=8888,server=y,suspend=n". Here's an example:

    conf.setDebug(true);
    conf.setMaxSpoutPending(10);
    conf.put(Config.TOPOLOGY_WORKER_CHILDOPTS, "-XX:+HeapDumpOnOutOfMemoryError");
    conf.setComponentJvmOptions("word",
        "-agentlib:jdwp=transport=dt_socket,address=8888,server=y,suspend=n");
    conf.setComponentJvmOptions("exclaim1",
         "-agentlib:jdwp=transport=dt_socket,address=8888,server=y,suspend=n");
  2. Use the steps as given in the tutorial to set up remote debugging in Eclipse.

    To set up remote debugging with IntelliJ, see the remote debugging instructions .

  3. Once the topology is activated, start the debugger at localhost:{PORT} if in standalone local deployment or {IP}/{HOSTNAME}:{PORT} for multi-container remote deployment, and you will then be able to debug the code step by step.

@kramasamy
Copy link
Contributor

thanks @lucperkins - this looks excellent. @vidit-bhatia - please review and use the contents provided by @lucperkins

@kramasamy
Copy link
Contributor

@vidit-bhatia - just wondering if you had a chance to take a look at this.

@vidit-bhatia
Copy link
Contributor Author

@kramasamy @lucperkins looks good committing now

@kramasamy
Copy link
Contributor

@vidit-bhatia - please update the pull request with the content of @lucperkins - then I can merge it.

@vidit-bhatia
Copy link
Contributor Author

@kramasamy done

@kramasamy kramasamy merged commit 694c6e6 into apache:master Sep 23, 2016
@vidit-bhatia vidit-bhatia deleted the vibhatia/tshootjavatopo branch September 23, 2016 05:17
nicknezis pushed a commit that referenced this pull request Sep 14, 2020
Added the steps for debug java topologies
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants