The error "Jrun closed connection" may be encountered within a ColdFusion application. This is caused by an issue occurring in the JVM, which in turn causes the JVM to close the socket that is open to JRun from the external web server connector, such as IIS, Apache, or iPlanet.

The problem can occur due to several issues, such as:

  • outOfMemory or the JVM approaches the max heap
  • Native code in a CFX or COM objects causes an error in the JVM
  • Socket closed during a restart of the ColdFusion services

JVM memory issues can occur due to several different issues, most commonly:

  • Debugging is turned on in production. Make sure debugging is turned completely off on production servers to prevent this from happening.
  • Large resultsets are returned from the database, taking up a significant amount of memory. If you cannot allocate additional memory, Macromedia recommends customers reduce the size of their database result sets.

Use the following steps to debug the issue:

  1. On the Settings page in the ColdFusion Administrator, turn on the "Timeout Requests after (seconds)" option and set the value to 30 seconds. Enabling this option prevents unusually lengthy requests from using up server resources. Requests that take longer than the timeout period are terminated.
  2. On the "Logging Settings" page in the ColdFusion Administrator, turn on "Log slow pages taking longer than X seconds" and set the value to 30 seconds. Logging slow pages can help you diagnose potential problems or bottlenecks in your ColdFusion applications. Entries are written to server.log.
  3. Upgrade the JVM to the latest version (1.4.2_08, as of 5/11/05) from java.sun.com/j2se/1.4.2/download.html.
  4. On the "Java and JVM" page in the ColdFusion Administrator, modify the "Java Virtual Machine Path" to point to the new JVM. For example:



    C:\j2sdk1.4.2_08
  5. Enable JRun metrics:

    1. Make a backup ofcf_root/runtime/servers/default/SERVER-INF/jrun.xml.
    2. Uncomment the following entry:
      <service outputclass="jrunx.metrics.MetricsService" name="MetricsService"><attribute name="bindToJNDI">true</attribute></service>
    3. Modify the LoggerService entry to:



      <service outputclass="jrunx.logger.LoggerService" name="LoggerService"><attribute name="metricsEnabled">true</attribute><attribute name="metricsLogFrequency">5</attribute>
  6. On the "Java and JVM" page in the ColdFusion Administrator, enable verbose garbage collection by adding the following arguments to the JVM Arguments field:



    -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintHeapAtGC
  7. Stop the ColdFusion Server service.
  8. Delete all logs in cf_root/logs andcf_root/runtime/logs.
  9. Using the steps in TechNote 18339, start ColdFusion from a command prompt. For example:



    c:\CFusionMX\bin\ cfstart > out.txt
  10. Run cfstat to monitor the requests. For example:



    c:\CFusionMX\bin\ cfstat 5>c:\cfusionmx\logs\cfstat.out
  11. When the error is thrown or the site becomes unresponsive, generate a stack trace. Examine the stack trace using the steps in TechNote 18339.

Additional Information

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License  Twitter™ and Facebook posts are not covered under the terms of Creative Commons.

Legal Notices   |   Online Privacy Policy