php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34978 php out of memory or segmentation fault while installing sugarcrm 3.5.1a
Submitted: 2005-10-25 19:08 UTC Modified: 2005-11-02 15:37 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: cdc at ccicon dot com Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.0.5 OS: linux i386
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: cdc at ccicon dot com
New email:
PHP Version: OS:

 

 [2005-10-25 19:08 UTC] cdc at ccicon dot com
Description:
------------
When installing sugarcrm vs 3.5.1a (or earlier) php 5.0.5 generates a out of memory error, or, if >36Meg memory, will generate a segfault.

This problem is reproducible with both apache 2.0.54, 2.0.55, sugarcrm 3.5.1, 3.5.0, 3.0.  I also tested the php 5.0.6-dev snapshot from 200510251443 and it exhibited the same problem.  Php 5.0.4 does not exhibit this problem.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-10-25 19:14 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-10-25 22:25 UTC] cdc at ccicon dot com
When using the suggested snapshot, the installer manages to complete successfully.  However, first login generates the following error when register_long_arrays is set ON

( Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 47 bytes) in /home/www/dev/htdocs/sugarsuite-3.5.1a/data/SugarBean.php on line 1087

When register_long_arrays is set off, php generates a segfault, which is apparently a documented problem with Sugar and php5.  This segfault condition also exists in php 5.0.4, however, turning register_log_arrays=On solves this problem in 5.0.4.
 [2005-10-26 06:38 UTC] cdc at ccicon dot com
I have tested this latest snap shot.  Like the previous 5.1RC4 snap shot, the installer phase completes successfully, however, first login results in an out of memory error as follows:

( Fatal error: Allowed memory size of 67108864 bytes exhausted at /usr/local/apache_src/php5-200510260230/Zend/zend_hash.c:242 (tried to allocate 58 bytes) in /home/www/dev/htdocs/sugarsuite-3.5.1a/data/SugarBean.php on line 1087)

This occurs with register_long_arrays=on.  Unlike the previous snapshot, which segfaulted when register_long_arrays=off, this one generates the same out of memory error regardless of the register_long_arrays setting.

As this drop is not segfaulting I'm not sure how to provide a backtrace of this problem.  Please advise.

TTYL
  CDC
 [2005-10-26 16:43 UTC] cdc at ccicon dot com
I realize that a general out of memory condition is not a bug.  However, this appears to be some kind of race condition that is consumming memory.  This problem in new since version 5.0.4.  The same code runs fine under 5.0.4 but generates this race condition in 5.0.5 and newer.  

As you can see from the error message below, I already have the memlimit set at 64M.  I started at 16.  It makes no difference where I have it set, the race condition consumes all available memory and fails with an out of memory error. 

I will attempt to isolate the code in sugar which is resulting in the race condition, however, the fact remains that this code runs fine under 5.0.4 and does not run under new versions.
 [2005-10-26 17:10 UTC] iliaa@php.net
Can you create some sort of a simple test case?
For example if you pass all get/post/cookie data from the failing request to <?php phpinfo(); ?> script do you get the same error?
 [2005-10-26 21:00 UTC] cdc at ccicon dot com
From the application logs, it is apparent that many hundreds, even thousands of lines of code are executing successfully after the post before this out of memory condition occurs.  I have not yet been able to trace the exact code location as I cannot step the code in my Zend Studios environment using php 5.1.  It appears the the code may be dying on either and array_merge or in a mysql call.  I will roll back to php 5.0.5, which I can step in the Zend debugger, and attempt to isolate the exact section of code which is generating these errors.  If I can locate it, I can perhaps write a small test script to reproduce the error under the CVS snapshot release.

This will likely take me a day or two to complete.

Thanks for your continued attention to this problem.

TTYL
  CDC
 [2005-10-27 11:56 UTC] rrichards@php.net
I can't say the exact point of failure (though its due to how the objects are linked to each other), but I recently had to get a highly modified version of this running under 5.1 and it was falling into infinite loops. Had to disable the ze1.compatibility_mode, remove the majority of explicit reference usage (xxx = & object) and use some explcit clone calls in spots. Runs stable after those changes, so not sure if this is just a PHP compatbility issue.
 [2005-10-27 17:27 UTC] iliaa@php.net
When getting the error is ze1 compact mode enabled or disabled and does changing the setting alter the behaviour in any way?
 [2005-10-27 18:53 UTC] cdc at ccicon dot com
I assume you meant ze1_compatiblity_mode and compact was just a typo?  Yes compatibility_mode is set.  It is explicitly set numerous places within the Sugar Code.  I can try changing it, but I'm assuming it was set within the code for a reason.

I'll try changing it and see what happens.
 [2005-10-27 19:10 UTC] cdc at ccicon dot com
The zend.ze_compatiblity_mode is set to 1 in the index.php file and several other files using the following test for php version number

if (substr(phpversion(), 0, 1) == "5") {
        ini_set("zend.ze1_compatibility_mode", "1");
}

Disabling this option (ie zend.ze_compatiblity_mode=0) under php 5.0.5 and under the last cvs snapshot that was recommended seems to solve this race condition.  I have not tested the code fully to see that this hasn't introduced other problems.  However, it does remove the out of memory and segfault problems.

Were there changes made in php 5.0.5 and later that make this option obsolete.  Or, will disabling this condition lead to other compatility issues?

TTYL
  CDC
 [2005-11-01 11:41 UTC] sniper@php.net
This is really critical issue. Obviously that stupid "compatibility" mode misbehaves still?
 [2005-11-01 13:40 UTC] dmitry@php.net
Can anybody provide a test case?
May be this bug already fixed in HEAD and PHP_5_1.
 [2005-11-01 13:52 UTC] cdc at ccicon dot com
I have tried to locate the exact code triggering the bug but have so far been unsuccessfull.  So, I have been unable to come up with a simple test case.  The bug is easily reproducible by trying to load and run the Sugar code available here 
http://www.sugarforge.org/frs/download.php/466/SugarSuite-3.5.1a.zip

I can tell you that the bug still existed in the following CVS snapshot.

php5-200510251830

If you believe that it might have been fixed in a newer snapshot, I would be happy to test it.  Just point me at it.

TTYL
  CDC
 [2005-11-02 10:15 UTC] dmitry@php.net
As I expected, the bag was already fixed in CVS HEAD and PHP_5_1 togehter with bug #34712.

Now I backported the fix to PHP_5_0 too.
 [2005-11-02 15:37 UTC] cdc at ccicon dot com
Awesome!  I just checked out and built the latest php-5.0 cvs tree and the backport of the fix does indeed fix the ze1_compatibility_mode problems with sugar!  

Thanks!  I'll pass the word along to the Sugar folks.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 21:01:31 2025 UTC