How to Troubleshoot a Runaway Process in Drupal

How to Troubleshoot a Runaway Process in Drupal thumbnail
Runaway processes spin until Drupal becomes unresponsive.

Drupal is a popular, open-source content management system, but sometimes its strength is also its weakness. Anyone can extend the functionality of Drupal or, if they choose, edit the core scripts. However, these changes can create loops in the software's logic. In an attempt to find a resolution, the software begins to consume more and more of the server's resources until there are none left. Consequently, the website freezes, and the hardware may become unresponsive. If this happens to you, you'll need to troubleshoot these runaway processes.

Things You'll Need

  • Text editor
  • FTP client
  • SSH client
Show More

Instructions

  1. Find the Cause

    • 1

      Roll back any recent changes. If that increases Drupal's speed and responsiveness, the new code contains the problem.

    • 2

      Investigate your server processes. In a Linux build, run "top" to see what is consuming resources. In a Windows build, launch the Process Monitor. If the most consumptive process is "mysql" or "mysqld" then you'll know it's database-related.

    • 3

      Review your Drupal logs. Look for identical, repeated messages. Using the paths referenced, work through the modules to discover what is triggering them.

    • 4

      Check your server logs to see if someone is artificially triggering a periodic process (ie., "poormanscron") to consume resources on your server.

    Implement a solution

    • 5

      Remove infinite loops in contributed code. For example, if you have a "drupal_goto();" function on page one that points to page two, and page two contains its own "drupal_goto();" back to page one, you will create an infinite loop. Removing one of the offending functions will eliminate the runaway process.

    • 6

      Simplify memory-intensive actions (such as database and string searches) in your contributed code. For example, a mySQL query which searches every node and returns a large amount of data may consume too much memory. In this case, limit mySQL queries to specific node types or node creation dates and constrain the data returned.

    • 7

      Increase PHP's memory_limit allowance. In some circumstances, a runaway process may not be a problem after increasing the memory allowance. The "Drupal: Increase Memory Limit" document, offered as part of the Drupal installation guide, is the definitive resource for making this change.

    • 8

      Prohibit outsiders from triggering memory-intensive processes like search indexing. If Drupal's permission grid doesn't offer enough granularity, you can also do this by employing server and file-based permissions using the host machine's operating system (ie., "chmod" for Linux). Alternatively, use IP-based blocking within the server software (like Apache) to keep others from interfering with your site's performance.

Tips & Warnings

  • Finding a runaway process in Drupal is a lot like detective work. Work slowly and collect clues as you investigate to find the true cause of the problem.

  • Increasing the memory allowance is a good short-term fix, but in time most runaway processes will consume those resources as well. Also, always make a backup of your site before making any changes!

Related Searches:

References

Resources

  • Photo Credit Photos.com/AbleStock.com/Getty Images

Comments

Related Ads

Featured