Hi all,
Is there a better way to debug unclosed resource resolver or session objects ?
i could look at JMX and sessionstatistics and perhaps session count but is there a way to identify for an object there what created it and are there unclosed session objects or resource resolvers?
i see nothing in init stack trace and logs alone is being of help where I am looking for a trace of my class to check for unclosed resource resolver at the moment
Please let me know better ways
Solved! Go to Solution.
Views
Replies
Total Likes
Hi @NitroHazeDev ,
Since the 'system/console/status-Threads' has snapshot of all the threads so it is helpful in getting the thread info and their status.
Also, JMX can provide information about the sessions that are currently open and the resource resolvers that are currently in use. However, it is not possible in my opinion to determine the specific class that created a session or resource resolver using JMX. Try following these steps:
You might need to register the com.day.crx.core MBean to enable the JMX remote connector in the AEM instance. To do this, you will need to add the following configuration to the AEM instance's start script:
-Dcom.sun.management.jmxremote.port=<port> \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false
Note: The above configuration will disable SSL and authentication for the JMX remote connector. This is not recommended for production environments.
Let me know how you go.
Thanks,
Monendra
if you have personally guaranteed that all your code is wrapped around with the JAVA 7 resource block, checked all sessionstatistics, etc... The next thing you can do is just deploy the code, and wait for a couple of days to get Adobe's looking glass report. From there they can determine what else you might have missed.
Anything other than looking glass? Like jmx etc ? How do you check with session stats is the question for the specific session you create
Here are a few approaches you can explore to debug unclosed resource resolver or session objects in AEM:
Use the AEM JMX console: The AEM JMX console provides a number of metrics and attributes that can be useful for debugging resource resolver and session objects. For example, you can use the SessionStatistics MBean to view the number of active sessions, the number of closed sessions, and the number of sessions that have timed out. You can also use the SlingRepositoryStatistics MBean to view the number of active resource resolvers and the number of closed resource resolvers.
Use the AEM Health Check service: The AEM Health Check service provides a set of checks that can help identify potential issues with resource resolvers and sessions. You can use the SessionCheck and ResourceResolverCheck checks to view the number of active and closed resource resolvers and sessions, and to detect potential leaks.
Use the AEM Logging service: The AEM Logging service can be useful for debugging resource resolver and session objects because it provides detailed logging information about the creation and closure of these objects. You can use the com.day.crx.core.Session
and com.day.crx.core.ResourceResolver
loggers to view the stack traces of the methods that create and close resource resolvers and sessions.
Use a code profiler: A code profiler is a tool that can help identify potential issues with resource resolver and session objects by analyzing the performance of your code.
By using one or more of these approaches, you should be able to identify and debug unclosed resource resolver and session objects in AEM.
Thanks,
Monendra
Thanks @Monendra_Singh
For #1- is there a way to know which is open and which is closed and what is the class or stacktrace? A lil bit more detail will help
I for instance have a sling model and I get the resource resolver by using @inject or I can get by resource.getResourceResolver . I sent it to another service class but don’t think it’s right since passing it might mean it is out of scope and I might need to open it again in the service using try resource block with a service user.
debugging this would help . I see no errors in console but want to be sure
#2 - where can I find it and how do I detect leaks more details or snapshots would help
#3- do we set them at info level and do they provide details as to which class is causing the issue with sessions
Are they valid packages could not find them on 6.5.12.. com.day.crx
#4 - any example used ?
Hey mate,
JMX console in AEM:
SessionStatistics
When you go to Tools -> Operations -> Monitoring. You get an option to create heaps of monitoring options including 'no of active sessions'.
Here you can create your own custom monitoring based on the available JMX beans.
You can get session count in JMX as well.
Also, You can connect amd monitor it using jconsole, here is the screenshot of my local machine
You can go to mbean section and explore if you get what you want as you have lots of information available there. Do let me know how you go.
Thanks,
Monendra
Thanks @Monendra_Singh , i am doing the same, but wondering if it tells me clearly what specific class created the session for instance.
Is that something that JMX can tell me ? i tried picking the id from the sessionstats repo reader and went to /system/console/status-Threads, is this the way?
Thread #2102/Thread-1827 [priority=1, alive=true, daemon=true, interrupted=false, loader=java.net.URLClassLoader@4130a648]
I tried the packages, couldn't find it autopopulated for resource resolver unclosed sessions debug
Hi @NitroHazeDev ,
Since the 'system/console/status-Threads' has snapshot of all the threads so it is helpful in getting the thread info and their status.
Also, JMX can provide information about the sessions that are currently open and the resource resolvers that are currently in use. However, it is not possible in my opinion to determine the specific class that created a session or resource resolver using JMX. Try following these steps:
You might need to register the com.day.crx.core MBean to enable the JMX remote connector in the AEM instance. To do this, you will need to add the following configuration to the AEM instance's start script:
-Dcom.sun.management.jmxremote.port=<port> \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false
Note: The above configuration will disable SSL and authentication for the JMX remote connector. This is not recommended for production environments.
Let me know how you go.
Thanks,
Monendra
Views
Likes
Replies
Views
Likes
Replies