Skip to content

Prevent the The Native Tracing Agent config-write-period-secs option from creating an unbounded number of config subfoldersΒ #12767

@justy152

Description

@justy152

Feature request

Please include the following information:

Is your feature request related to a problem? Please describe.
When I configure the Native Tracing Agent to periodically write config using the config-write-period-secs option, the lock file prevents the config from the last periodic write from being overwritten, and instead the latest config is written to a new subfolder. This happens every time after the first write and my long running process ends up creating several subfolders of config, when I really just want the latest one. I would have to clean up all the old subfolders, and the latest subfolder name isn't that predictable.

Describe the solution you'd like.
The lock file contains the process PID. When we try to write a new lock file and find that it already exists, we should then compare the PID in the existing lock file to the PID of the current process and if the PIDs are the same we should continue to overwrite the config in the config-output-dir.

Describe who do you think will benefit the most.
This will benefit all users who use the native tracing agent for long running processes like microservices. For example, I want to be able to add an endpoint to my Helidon webserver that serves up the latest config when running with the tracing agent. I will use that endpoint to build subsequent native images of that microservice. At the moment I have to run my microservice, interact with it, then shut it down, and then retrieve the config - I think using my endpoint is more convenient.

Describe alternatives you've considered.
I've tried specifying the config-merge-dir but it suffers from the same lock file problem. I've also considered trying to clean up the old temporary directories and deleting the lock file, but both of these options feel like workarounds and the config-write-period-secs option is perhaps not working as originally intended.

Additional context.
The documentation for this config-write-period-secs option appears here: https://www.graalvm.org/latest/reference-manual/native-image/metadata/AutomaticMetadataCollection/ - it doesn't suggest that we need to do any housekeeping around it in order to work with the lock file restriction.

Express whether you'd like to help contributing this feature
Yes I wouldn't mind helping to contribute this feature!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions