Analyze Open Session In CQ

Miscellaneous Administration‎

Analyze Open Session


  • System is performing slow
  • There is a lot of open session error in log
  • System runs out of memory after some time

Any writes or update in repository through API is done through JCR session. But some time developers forget to close session causing session to remain open. As number of open session grows it cause performance issue. System eventually come to a point where it does not respond any more.

How to find Open Session:

  • First find PID of CQ process using ps -ef | grep java | grep <author | publish> or jps -l or control + shift + U (In windows) command.
  • Once you have process ID you can use jmap -histo <PID> | grep "CRXSessionImpl" command to find all open session. If output count is more than 100 that mean there could be some issue.

How to find code not closing session:

  • In order to start CQ in session debug mode, you can use -Dcrx.debug.sessions=true JVM_OPTS while starting CQ
  • Then use following command to analyze log file java -jar session_analyzer.jar <log_file> | sort > output.txt
  • You can find session_analyzer.jar from here
  • You can then analyze output.txt to find open session


ResourceServlet.spoolResource( session# 10023

This example means session #10023 was not closed, and the stack trace included the given lines when the session was opened.