Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ApplicationInsights-agent-3.4.12 generate otel-agentXXX/agent.jar files in windows/Temp which consumes all memory #3183

Open
fred-sudo opened this issue Jul 10, 2023 · 2 comments

Comments

@fred-sudo
Copy link

Expected behavior

temp generated agent.jar file in windows/Temp folder should be removed automatically because the programmer did not write or program to create the jar file.

Actual behavior

The file agent.jar in windows/Temp/otel-agentXXXXXXXXXX/agent.jar is not getting deleted. It creates an out-of-memory issue on the server. Admin is not supposed to write batch process to write windows based another batch script to delete these files

To Reproduce

any spring boot-based batch process using application-insights lib 3.4.12 will reproduce the same issue

System information

Please provide the following information:

  • SDK Version: java 1.8-351
  • OS type and version: windows 10
  • Application Server type and version (if applicable):
  • Using spring-boot? yes
  • Additional relevant libraries (with version, if applicable):

Logs

logs are just file but in windows/Temp/otel-agentXXXXXXXX/agent.jar files are creating pollution. there is a well-known issue of Windows OS java can not delete jar file bugs.openjdk.org/browse/JDK-8219681. but using RandomAccessFile class of standard jdk lib it must be possible to delete the file. RunTime.getRuntime.addShutdownHook() or deleteonExit() definitely should work. Or ApplicationInsights-agent lib has to manage this without creating an agent.jar file

Screenshots

Not possible to bring screenshots here

@jeanbisutti
Copy link
Member

Hi @fred-sudo
Thank you for having reported this issue.
Application Insights runtime attach component uses a runtime attach OpenTelemetry component. file.deleteOnExit() is invoked (deleteOnExit() uses a JVM shutdown hook behind the scene).
We could look at this issue on Microsoft side. Would you be interested in fixing this issue on the OTel side? In this case, we could help you contribute to the OTel component.

@fred-sudo
Copy link
Author

fred-sudo commented Jul 11, 2023

Thank you so much I would be happy to fix the issue on OTel side. I can work on [private static void deleteTempDirOnJvmExit(] with the other options mentioned. my observation -- this issue is on the Windows server only. for my laptop OS it could not see these jar files in Windows/Temp folder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants