Sunday, June 8, 2014

"zend_mm_heap corrupted" after running PHPUnit test suite (in PHP 5.5)

Update 8th Jun 2014 20:10 UTC

Downgrading to PHPUnit 4.1.2 helped and the error disappeared. I was accidentally on the development branch of 4.2.

This afternoon I encountered a very strange error "zend_mm_heap corrupted" from the PHP runtime after running a full project testsuite with PHPUnit.

As you can see from the screenshot above, the whole test suite completes fine. However the PHP process itself crashes making the exit code of the run be non-zero (and eventually failing the Jenkins build).

Google revealed many articles related to the error, but none of them actually were similar to my issue. Stack Overflow has a bunch of different solutions that have worked for developers struggling with this very random error:
  • Increase php.ini's output_buffering value
  • Set zend.enable_gc = 0
  • Disable APC
  • Set = 0
None of them helped.

I found one interesting post at PHP Freaks forum stating that by tweaking some environment variables we could modify the behavior of PHP memory management
  • ZEND_MM_TYPE=mmap_anon
The last one changed the error message - I did not get zend_mm_heap corrupted anymore but instead got a segfault and core dumped:

*** Error in `php': double free or corruption (!prev): 0x0995b660 ***

*** Error in `php': double free or corruption (!prev): 0x0a17a6b0 ***

The new error message is not that much clearer than previous one. So, it really seems I've hit some very strange bug somewhere, just don't know where.

Friday, October 18, 2013

Trying to upgrade MongoDB via apt-get - but "Unable to find expected entry '10gen/binary-amd64/Packages' in Release file"?

Update 18th Oct 2013 at 22.20 UTC:
It seems that 10gen has changed the original configuration back, thanks Mr. Mike Stringer for noticing. So, source configuration

deb dist 10gen

works at this moment. I will keep eye on the repository changes, follow me @vjom for further updates.

Mr. Robert Meerman has also reported the (original) issue to MongoDB's JIRA. Hope we'll get clarification soon which one to use... ;)

Tonight, I tried to upgrade to the latest MongoDB server version in my Ubuntu box, but apt-get update gave the following error:
W: Failed to fetch  Unable to find expected entry '10gen/binary-amd64/Packages' in Release file (Wrong sources.list entry or malformed file)
It seems that 10gen has recently changed their Release file structure, but the Ubuntu installation documentation does not yet reflect their latest changes (as per 18th Oct 2013). The problem is easy to fix:

Find the file, where your current mongodb-10gen source configuration lies. Most likely it's /etc/apt/sources.list.d/mongodb-10gen.list

Change the following line
deb dist 10gen
to read
deb dist mongodb
Finally, run apt-get update again and you are good to go.