Jump to content

Cron unstable segmentation fault / heap corruption / 500 read timeout


Recommended Posts

Ever since a few days ago our cron is failing miserably.


The errors are mostly segmentation fault - and nothing else.


One day we received this:


"ALERT - linked list corrupt on efree() - heap corruption detected (attacker 'REMOTE_ADDR not set', file 'unknown')"


I tried moving from PHP to GET as per the automation settings but I get this:

"500 read timeout"


We have been running our CRON wrapped in this:

ini_set('memory_limit', '1024M');


I tried it with and without the wrapper. The situation is very urgent and I have logged a support ticket with WHMCS as well. They normally get back very quickly but not this time and it makes me worry.


Could a Linux boffin please shed some light?

Link to comment
Share on other sites

  • 2 years later...

Did you get a resolution to this? We're having the same problem.


This person solved it by downgrading php: http://www.webhostingtalk.com/showthread.php?t=889065


This person solved it by raising the memory limit for php in php.ini: http://www.overdrivedesign.biz/blog/whcms-segmentation-fault-with-pop-php/


The former is not really and option for us. The latter we've tried (even setting the memory limit to as high as 1Gb) but with no success.


Any ideas anyone?

Link to comment
Share on other sites

Could be indicative of memory corruption; among other things. It could be the script itself, an installed PHP extension, hardware issue, etc.


What are the messages in your error_log surrounding the ALERT entry? You can also utilize strace to find where the seg-fault is happening.


My first thought is, possibly, APC is causing a seg-fault which is then caught by suhosin as an attack.

Edited by WHMCS JamesX
Link to comment
Share on other sites

segfaults are typically caused by PHP modules that are corrupt. Unfortunately, they're very difficult to investigate. I would ultimately recommend you increase the servers global php.ini rather than relying on ini_set as well.


However, if you do need to isolate it - you would want to use strace (a linux command utility) to do so.


The command would be something like:


# strace -Ffvt -s 4096 -o cron.out php /path/to/cron.php

- from there you would read the output of cron.out, find the segfault, and begin reading up to the last instances it hit.


I'd also recommend looking at your PHP modules and see which may recent, or compiled using nonphp source. ie: from sourceforge instead of php.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated