Backend Development 5 min read

Remote Debugging Guide for Sandbox and Test Environments

This article explains how to set up remote debugging for services in sandbox or test environments, covering remote creation, locating debug ports, constructing JVM arguments, checking service status, stopping services, and useful alias commands to streamline the debugging process.

转转QA
转转QA
转转QA
Remote Debugging Guide for Sandbox and Test Environments

Background: When developing multiple projects, testing in a sandbox environment with large production-like data makes reproducing issues difficult, so remote debugging is essential.

1. Create Remote: Follow the illustrated steps to add a remote configuration (see images).

2. Locate Debug Port:

Method 1: In the SIC platform, navigate to Service Information, find the relevant service (e.g., tapd_data_server ), and view the debug port under Service Configuration.

Method 2: Identify the startup parameters for the service and construct the debug command. Example using tapd_data_server :

/xxxx/xxxx/service/tapd_data_server/conf

Search for the environment’s startup parameters and assemble the full JVM argument string, such as:

/xxxx/xxxx/jdk/jdk1.8.0_191/bin/java -Xms2g -Xmx2g -Xmn2g 
-Dspring.profiles.active=sandbox 
-javaagent:/opt/soft/jacoco/lib/jacocoagent.jar=includes=com.xxxx.*:com.xxxx.*,output=tcpserver,address=1xx.xx.xx.172,port=xxxx
-javaagent:/opt/soft/zztools/transmittable-thread-local/transmittable-thread-local.jar 
-javaagent:/opt/soft/zzapm/pinpoint-bootstrap.jar 
-Dpinpoint.applicationName=tapd_data_server 
-Dpinpoint.agentId=xxxx_server.1xx.xx.xx.172 
-Dzz.service.type=xxxx 
-Dzz.service.name=tapd_data_server -jar 
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=12345 /xxxx/xxxx/service/tapd_data_server/tapd_data_server.ja

Explanation of the command components:

cmd – executable or script path.

Path to Java binary: /xxxx/xxxx/jdk/jdk1.8.0_191/bin/java .

JVM arguments for memory, profile, and Java agents (Jacoco, Transmittable Thread Local, Pinpoint, etc.).

JDWP agent for remote debugging: -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=12345 .

3. Check Service Status: Run the alias command xxxx list to view current services.

4. Stop Service: Use xxxx stop xxxx_server (or xxxx restart xxxx_server ) and then execute the assembled debug command to start debugging.

5. Summary:

Quickly locate and resolve issues.

Debugging is crucial; many tips are available via practice or online resources.

Exercise caution in production environments—avoid debugging directly on live systems.

6. Extensions:

Alias Management:

Set an alias: alias alias_name='original_command -options/parameters' (e.g., alias ll='ls -lt' ).

View defined aliases with alias or alias -p1 .

Remove an alias using unalias alias_name (e.g., unalias lll ).

Persist aliases across sessions by adding them to ~/.bashrc and reloading with source ~/.bashrc .

Author: Han Shuzhen; Compiled by: Zhuang Jindi.

BackendJavaTroubleshootingSandboxservice managementremote-debuggingalias
转转QA
Written by

转转QA

In the era of knowledge sharing, discover 转转QA from a new perspective.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.