java.lang.OutOfMemoryError in ColdFusion

java.lang.OutOfMemoryError is certainly not a new error in ColdFusion. If you look around the web, you will find many articles. I thought of creating my own steps to be followed, as well as, how to fix the same. This article is based on a Windows platform.

Jcosole is a JMX-compliant graphical tool for monitoring a Java virtual machine. It can monitor both local and remote JVMs. It can also monitor and manage an application.

http://docs.oracle.com/javase/7/docs/technotes/tools/share/jconsole.html

The jconsole executable can be found in JDK_HOME/bin, where JDK_HOME is the directory in which the Java Development Kit (JDK) is installed. If this directory is in your system path, you can start JConsole by simply typing jconsole in a command (shell) prompt. Otherwise, you have to type the full path to the executable file.

You can use JConsole to monitor both local applications, namely those running on the same system as JConsole, as well as remote applications, namely those running on other systems.

http://docs.oracle.com/javase/7/docs/technotes/guides/management/jconsole.html

As per our discussion, below are the steps for monitoring the Memory:-

  1. Stop the ColdFusion service and start ColdFusion from Command prompt. See instructions here.
  2. Press CTRL+ALT+DELETE, and then click Task Manager.
  3. In Task Manager, click the Process tab, click View, and then click Select Columns.
  4. In the Select Columns dialog box, click to select the PID (Process Identifier) check box, and then click OK. You see that the PID column has been added to the Process tab. If not, Enable PID in Task manager: View>Set Column> Check PID
  5. You can now locate the PID and the corresponding executable file that started the process in Task Manager.
  6. Start another command prompt and go JDK_HOME/bin and type jconsole pid
  7. Monitor the graph.

If the non-heap memory is increasing then, the permgen value needs to be recalculated. Whereas, if the heap memory is increasing then the Xmx needs to changed.

These articles are for JRE 7, however, the logic remains the same for JRE 8 as well. If you are on JRE 8, then permgen will be replaced by metaspace. The memory referred to hear is defined in the jvm.config at \ColdFusion11\cfusion\bin\. The same can be changed Server Settings > Java and JVM under ColdFusion Administrator.

Note:- Please take a backup of the jvm.config, before making any changes in the ColdFusion Administrator or the actual file. Changes to JVM would require a ColdFusion service restart.

One of the old ColdFusion article http://www.adobe.com/devnet/coldfusion/articles/coldfusion_performance.html for performance tuning helps in understanding various other parameters related to memory tuning and performance.

Advertisements

Happy Birthday, whose birthday – It’s ColdFusion

Yes, you heard it right. ColdFusion turned twenty today. I see CF veterans and patrons, all around the world.  

Glad to be a part of this community.

ColdFusion 12: It’s your chance to contribute

We recently announced the opening of ColdFusion 12 Pre-release program here. It’s your chance to participate and contribute towards the newer version. It’s time that you help Adobe, build a robust version for Production servers directly, by contributing with your ideas, skills, past experience with ColdFusion, issues you are currently facing. Lastly, contribute to the next version of ColdFusion, and make it a better product in market.

Take the short survey and you may be selected to participate.

 

Do participate and make the difference.

Unable to Start ColdFusion 11, Error at Creation of SecureRandom instance

Ever landed in a situation, where you are unable to start ColdFusion 11. On a windows environment, you may see an alert, like the below screenshot, under Windows Event Viewer.

Event Viewer Error

Now, there could be multiple reasons for the same. On a non-windows environment, when you start the service from Terminal/Command Prompt, you can see the stack trace for service startup. On a windows environment, you can try the following:-

  1. Stop ColdFusion service, if already running.
  2. Launch Command prompt as Administrator.
  3. Browse to cf_root\cfusion\bin and run the following command cfstart.bat
  4. Try to access the CF admin, once the services are started.

In case it gives an error message, then it will help you trace out the root cause and the stage, where ColdFusion is unable to start.

Recently, I got few users, who were facing issues with ColdFusion 11 service start up. When we checked the terminal/command prompt, we found the below stack trace:-

Apr 1, 2015 2:50:17 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\CF11\cfusion\lib;D:\CF11\cfusion\jintegra\bin;D:\CF11\cfusion\jintegra\bin\international;D:\CF11\cfusion\lib\oosdk\classes\win
Apr 1, 2015 2:50:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8523"]
Apr 1, 2015 2:50:18 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8015"]
Apr 1, 2015 2:50:19 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Apr 1, 2015 2:50:19 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.54
Apr 1, 2015 2:50:25 PM org.apache.catalina.util.SessionIdGenerator createSecure
Random
INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [185] milliseconds.

It was struck at “Creation of SecureRandom instance for session ID generation using [SHA1PRNG]”. It stayed at the last line of the trace, and didn’t start the service at all.

Resolution

  1. Take a backup of context.xml at cf_root\cfusion\runtime\conf\
  2. Open it with notepad or any text editor.
  3. Uncomment the tag:      <Manager pathname=”” /> and save the file.
  4. Restart ColdFusion 11 Application Service

 Reasoning

You may land into this scenario, only if you have downloaded the Full installer for ColdFusion 11 Update 3 and are at CF11 U3 or above. If you have downloaded the  Refreshed installer released after the former, then, you will not face this issue.

Migration of ColdFusion Website: An Overview

Migration in itself is a very broader area. One has to keep in mind the Technology, Hardware, Operating System, Settings, Application Server, Web Server, Code compatibility and many other things, before starting the Migration process. And yes lastly, how much effort is needed. When you are dealing with Production websites or even the Testing/Development websites, you should have an action plan in place, even before you actually start migrating the website. So, I thought of making that easier and divide the entire process into different segments. IMO, an ideal migration (rather migration+ upgrade) involves the following phases:-

  • Installation of new CF version
  • Migrating the CF Settings
  • Migrating the web repository

And I will briefly discuss this below. Again, if you are simply migrating the site on the same server to a newer version, then you may not need the third step. If you changing the webserver, then first step is not required and likewise. Let us have a glance on these.

Installation of new CF version (say CF9 to CF 10/11)

This section talks about installing the version of CF you are upgrading to. Say you are upgrading from CF9 to CF11. So you will install CF11 first. The new CF installation can be on the same server or on a different server as well. During the installation, do not configure the connector with the same website (if on the same server). There could be a conflict, as there would be two different connectors (one from the older CF server and one from the new CF server) configured to the same website. So, you can configure it with the built-in server of ColdFusion and complete the installation. Once, your installation is complete, you can remove the connector, disable the built-in server and recreate the connector between ColdFusion and the webserver, say IIS, Apache etc.

Migrating the CF Settings

In this section, we are referring to the CF settings within the CF Admin, such as Datasources, Scheduled Tasks, Webservices etc. If you are installing the new CF server on the same server (where you already have the older CF server), then, you will be prompted to “Migrate” the settings during the install itself. In case the new CF server installation is on a different server then, you can create CAR file. This feature is only available in Enterprise/Developer version of ColdFusion, till version 10. ColdFusion 11 onward, its available in all editions. In case you missed the migration wizard and now can’t migrate the settings, please refer to this blog.

Migrating the web repository

This is actually the process of migrating your server repository or the website files. If the migration involves, setting up a new Server/webserver, then the easiest way is to copy the web files from the older webroot to the new webroot, under the new website. You can also use any third party utility to migrate the files and the settings (if any at the webserver level), if your webserver supports the utility. In case, the website resides on the same server and the installation only involves, CF server up gradation/migration, then recreate the connector. Remove the connector from the older CF server and create the connector to the new CF server.

Voila!!! Test your website. 🙂

This article is just to give all an overview about the migration process and as mentioned above, may vary from environment to environment. This is a strong recommendation to test your website on the Testing/Development environment, before moving it on Production.

Hope this gives a better picture of the migration process.

Remote server settings lost after restart, now fixed in ColdFusion Builder 3

Recently, I blogged about Setting up ColdFusion Builder 3 with a remote server. One of the comment was related to a bug in ColdFusion Builder 3. CFB3 was not retaining “Remote servers” after the restart. The settings were lost after restarting CFB 3. This bug was fixed in the latest installer available at ColdFusion Builder 3. Yes, the installer was updated with this fix with the release of CF10 Update 15/CF11 Update 3. You can check, whether you are at the current version or not. Check the build number (Help>>Product Details), in your CFB3. If it is not 292483, then, you need the latest installer on your server.

Also, regarding the original post on Adobe ColdFusion Blog, enabling RDS is not recommended on Production servers.