Has anyone encountered a similar issue where Dynatrace OneAgent instrumentation or automatic injection causes a java.lang.StackOverflowError in a PTC Windchill environment?
Based on our log analysis, repeated calls involving Dynatrace’s AgentInjectingWriter.flush() and Java’s PrintWriter.flush() appear to be contributing to the error. PTC has indicated that this error is triggering the Windchill Method Server to shut down.
We are currently using Dynatrace to monitor PTC Windchill. As an interim measure, we have disabled Full-Stack Monitoring/RUM in the affected environment to prevent further issues while the investigation is ongoing.
Could the Dynatrace community help clarify the following?
-
What could be the potential root cause of the recursive or repeated calls between AgentInjectingWriter.flush() and PrintWriter.flush()?
-
Could this behavior be related to a Dynatrace OneAgent instrumentation or injection issue, or a compatibility issue with the Java version or Windchill?
-
Are there any known issues, configuration changes, or recommended fixes to prevent this StackOverflowError and the subsequent Method Server shutdown?
-
What additional logs or diagnostic steps would you recommend to confirm the root cause?
Any insights or recommendations from anyone who has encountered a similar issue would be greatly appreciated.
Hi @gsaharan
I haven’t seen a Windchill-specific known issue, but this stack pattern has come up before, and it’s almost always related to RUM injection rather than core OneAgent instrumentation.
For Java servlet responses, OneAgent wraps the response PrintWriter in its own injecting writer (AgentInjectingWriter) so it can insert the RUM JavaScript. A StackOverflowError with AgentInjectingWriter.flush() and PrintWriter.flush() alternating means the writer chain has become circular. The injecting writer delegates to a writer that eventually delegates back to it.
Fixes and workarounds (least to most disruptive)
You only need to stop RUM injection on the Method Server process group. You keep traces, PurePaths and service monitoring, and only lose the Java-side injection.If you still want RUM, let PTC HTTP Server (Apache) do the injection and disable it on the Java/Windchill process. Check that you only have one injecting tier.
Alternatively, keep Java injection but exclude the problem URLs. You can use custom injection rules with “Do not inject” for specific paths, such as Windchill servlet/REST endpoints or non-HTML responses.
Given the specialized nature of PTC Windchill integration, open a Dynatrace Support ticket.
Thanks,
Sujit
This might happen when the OA feature “Java Real User Monitoring (RUM) Troubleshooting Mode” is active. Please work with support to turn it off.