php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77900 Memcache session handling, zend_mm_heap corrupted
Submitted: 2019-04-15 14:35 UTC Modified: 2021-03-25 16:41 UTC
Votes:8
Avg. Score:4.6 ± 0.5
Reproduced:8 of 8 (100.0%)
Same Version:5 (62.5%)
Same OS:2 (25.0%)
From: bb0072 at gmail dot com Assigned: cmb (profile)
Status: Closed Package: memcache (PECL)
PHP Version: 7.3.4 OS: Ubuntu 18.04.2 LTS
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bb0072 at gmail dot com
New email:
PHP Version: OS:

 

 [2019-04-15 14:35 UTC] bb0072 at gmail dot com
Description:
------------
When I try to use sessions in my script (php 7.3) with session.save_handler=memcache, I get the following error message: zend_mm_heap corrupted.
Same script on same server does work with php 5.6.

I use the php-memcache extension (not php-memcached!)

Software versions (the most recent stable versions from the Ubuntu 18.04 repo, and php versions from here: http://ppa.launchpad.net/ondrej/php/ubuntu bionic main):

 * php7.3-cli (7.3.3-1+ubuntu18.04.1+deb.sury.org+1)
 * php-memcache (3.0.9~20170802.e702b5f-1+ubuntu18.04.1+deb.sury.org+10)
 * memcached (1.5.6-0ubuntu1 )

Memcache.ini settings (/etc/php/7.3/mods-available/memcache.ini)
extension=memcache.so
[memcache]
memcache.allow_failover="1"
memcache.max_failover_attempts="20"
memcache.chunk_size="8192"
memcache.default_port="11211"
memcache.redundancy=1
memcache.session_redundancy=2
memcache.compress_threshold=20000




Test script:
---------------
<?php
ini_set('session.save_handler', 'memcache');
ini_set('session.save_path', 'tcp://localhost:11211');
session_start();
$_SESSION['test']=true;
session_write_close();
session_start();
var_dump($_SESSION);
session_write_close();


Expected result:
----------------
array(1) {
  ["test"]=>
  bool(true)
}

Actual result:
--------------
zend_mm_heap corrupted

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-06 21:00 UTC] tandre@php.net
I linked to this in https://github.com/websupport-sk/pecl-memcache/issues/65

The original bug report was for 3.0.9, but I assume there were significant refactorings in 4.0.5.2 (released in December 2019).

When I try to run this script in php 7.4.3-dev (NTS DEBUG) with PECL memcache 4.0.5.2, I see the following memory leak instead (low severity because it uses erealloc(), which is freed after each HTTP response on a web server):

```
ยป php --no-php-ini --php-ini test.ini test.php
array(1) {                                     
  ["test"]=>                                   
  bool(true)                                   
}                                              
[Fri Mar  6 15:40:14 2020]  Script:  '/path/to/test.php'
/tmp/pear/temp/memcache/php7/memcache_queue.c(35) :  Freeing 0x00007f0542e7d700 (208 bytes), script=/path/to/test.php
Last leak repeated 3 times
=== Total 4 memory leaks detected ===
```

Does anyone see other cases causing zend_mm_heap_corrupted with Memcache sessions in 4.0.5.2?
 [2020-10-05 10:42 UTC] jochem dot blok at fasterforward dot nl
I can reproduce this problem on PHP 7.4 with Ubuntu 20.04. Any progress on this issue?
 [2020-10-05 12:03 UTC] jochem dot blok at fasterforward dot nl
Updating the package to version 4.0.5.2 seems to resolve the issue. I made a bug report for the outdated version of the php-memcache package in Ubuntu 20.04. See https://bugs.launchpad.net/ubuntu/+source/php-memcache/+bug/1898548
 [2021-03-25 16:41 UTC] cmb@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: cmb
 [2021-03-25 16:41 UTC] cmb@php.net
The official bug tracker for PECL/memcache is now at
<https://github.com/websupport-sk/pecl-memcache/issues>.

So, if this is still an issue with either of the current memcache
versions (4 or 8), please file an issue there.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 02:01:28 2024 UTC