What is Unique Token in Process?
A Unique Token is a distinct string used to identify the target application process for which diagnostics need to be captured. The yc-360 script supports process identification for both Java and .NET applications.
Why Use a Unique Token Instead of a Process ID?
In many environments-especially in containers and orchestration platforms like Kubernetes-process IDs (PIDs) are ephemeral and can change frequently due to restarts or scaling events.
Using a Unique Token offers a more stable and consistent way to locate the target process based on a known identifier (e.g., jar name, class name, startup argument, or executable name), rather than relying on dynamic PIDs.
This simplifies automation, avoids manual lookups, and ensures the yc-360 script always targets the correct process, even across deployments.
Java Applications
How the yc-360 Script Locates Your Java Process
When you pass a token using the -p argument, the yc-360 script:
- Runs
ps -ef | grep <TOKEN> inside the host or container. - Filters the result to extract the process ID of the matching process.
- Uses the PID of matching processes to capture diagnostics such as:
- Thread dumps
- Heap dumps
- GC logs
- System metrics like top, netstat, iostat, etc.
- Depending on the execution mode, either stores artifacts locally or transmits them to the yCrash server.
Example
Suppose your application is launched with the following command:
java -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:/tmp/my-gc.log -jar buggyApp.jar buggyapp
1
In this case, buggyapp is a unique argument in the command line. You can pass buggyapp as the token to identify the process:
Important Note:
Ensure that the token is unique enough to identify only the intended process.
For Docker or Kubernetes, make sure the token appears in the process list within the container (you can check this using docker exec or kubectl exec with ps -ef).
What if the Token Matches Multiple Java Processes?
If the token you provide is not specific enough, the yc-360 script will match more than one process. In this case, diagnostics will be captured from all processes that contain the token in their command line.
Example: Generic Token (java)
Suppose you run the following processes on the same machine:
$ ps -ef | grep java
1001 2345 ... java -jar payment-service.jar
1002 2378 ... java -jar order-service.jar
1003 2399 ... java -jar buggyApp.jar buggyapp
1
2
3
4
The script will capture thread dumps, heap dumps, GC logs, and system metrics for all three processes (payment-service, order-service, and buggyApp).
Best Practice:
Always use a token that uniquely identifies the intended process. This ensures the yc-360 script only targets the right process and avoids collecting artifacts from unrelated applications.
.NET Applications
How the yc-360 Script Locates Your .NET Process
When you pass a token using the -p argument, the yc-360 script:
- Runs
tasklist | findstr <TOKEN> on the Windows host. - Filters the result to extract the process ID of the matching application.
- Uses the PID of matching processes to capture diagnostics such as:
- Thread dumps
- Heap dumps
- GC logs
- System metrics
- Depending on the execution mode, either stores artifacts locally or transmits them to the yCrash server.
Example
Suppose your application is launched and visible in the process list as:
tasklist | findstr PaymentService
PaymentService.exe 19468 Console 1 3,04,268 K
1
2
3
In this case, PaymentService is a unique string present in the executable name. You can pass PaymentService as the token to identify the process:
./yc -p "PaymentService"
1
Important Note:
Ensure that the token is unique enough to identify only the intended process.
Run tasklist | findstr <TOKEN> manually first to verify that only the intended application appears in the output before passing it to the yc-360 script.
What if the Token Matches Multiple .NET Processes?
If the token you provide is not specific enough, the yc-360 script will match more than one process. In this case, diagnostics will be captured from all processes that contain the token in their name.
Example: Generic Token (PaymentService)
Suppose the following processes are running on the same machine:
tasklist | findstr /I PaymentService
PaymentService.exe 19468 Console 1 304,268 K
PaymentServiceWorker.exe 20532 Console 1 98,120 K
PaymentServiceHelper.exe 22110 Console 1 45,332 K
1
2
3
4
5
6
./yc -p "PaymentService"
1
The script will capture diagnostics for all four matching processes (taskhostw, PaymentService, and tasklist).
Best Practice:
Always use a token that uniquely identifies the intended process. This ensures the yc-360 script only targets the right process and avoids collecting artifacts from unrelated applications.