SuiteCRM on MAMP ?

Hello guys

I succesfully installed SuiteCRM 7.10.10 on MAMP5
Everything is working fine excepted that as soon as i deploy modules (via module loader) that are installing new BEANS (modules) the system crash (impossible then to repair due to memory exhausted)

I tried of course to increase php memory up to 4G but no suitecrm is still crashing again and again.

As I tried multiples modules, even using Module Builder, I suspect that MAMP5 has an issue with SuiteCRM.
Do you have any idea to help ?

Step to reproduce :

  • install 7.10.10
  • go to admin > module builder
  • create a test package and test module (using basic template for example)
  • publish your package (you will download a zip file)
  • install it via module loader ==> should not complete and hang at “installing new Bean xxxx”
  • then if you go to admin > repair > quick repair --> your suitecrm will hang until you’re running out of memory whatever the value you set as memory limit

Any advice appreciated, I loose the entire day on this problem :frowning:

(any other LAMP stack running well on MACOSX will be appreciated either !)

Best Regards

Do you get a memory error in your logs? You should start be making sure you’re seeing the correct log messages that describe your problem. You can Google for help setting up the PHP error log in your php.ini.

1 Like

Yes I didn’t paste the error but there’s in deed the error trying to allocate xxx bytes typical error message in error.log Apache logs directory

The question is not what the error means but why as soon as I deploy a bean via module loader suitecrm (or mamp) is getting mad and explose any memory limit (before loading the bean a memory limit of 128M was enough why a simple empty bean would require 4G (and it’s even not working with 4g)

Something should not be installed properly maybe on MAMP ?

Any feedback of mamp users ?

Please go in Admin / Diagnostic, choose phpinfo, click to generate, then download, unzip and check your effective memory_limit. You need to make sure your setting is taking effect.

Also I suggest posting exact error messages here in the forums in the first place, it helps. Other people might be able to read more from your message than you do :slight_smile:

Thanks

1 Like

Error log after trying to quick repair (having clicked installed on my package via module loader)

[26-Oct-2018 21:45:56 UTC] PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 20480 bytes) in /Applications/MAMP/htdocs/SuiteCRM710/data/BeanFactory.php on line 115
[26-Oct-2018 21:45:56 UTC] PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 86016 bytes) in Unknown on line 0

Each time I try to quick repair same error regarding the memory

For PHPInfo, i Used the one included with MAMP :

I confirm that phpinfo via diagnostic tools also show 4G as memory limit.

In case it could help debug the problem, the error occurs each time I do either a quick repair or directly a “rebuild relationships” action.
(during quick repair it freezes/crashes during the build relationship phase)

Of course if I am going to delete the /modules/myModuleNale/MyModuleName.php file, Suitecrm is instantly recovering from the error (no more memory exhausted errors and the screen is displaying REALLY fast)

I really don’t understand why adding a single bean module is going to crash Suitecrm.

Trying to illustrate the problem :

I first installed from https://store.suitecrm.com/docs/store/selling-license the SampleLicenceAddon.zip file using module loader (it does not complete due to the same memory error)

If i am going then to Repair > Quick Repair I got :

You can see at the last line that it does not finish (by clearing cache file and then saying Done)

If I am editing /modules/SampleLicenceAddon/SampleLicenceAddon.php (rename the file or delete it) then the repair screen is working as expected :

Everything is back to normal

Hmmmmm I found something even more strange :
The number of lines processed in repair screen is really different from the case we have or not the memory error : 99 rows (with error) vs 178 (without error)

The strange fact is that this is the exact line where repair starts to rebuilkd custom relationship :

line 99 (OK IN ALL CASES) Processing relationship meta for surveyquestionoptions…Done
Processing custom relationship meta for accounts_bugs…Done

Is there a problem with custom relationship for custom modules ?

First quote : Screen with memory Error

Second quote : Without error

4GB is an enormous amount of memory for PHP, 512MB is more than enough.

If you’re exhausting 4GB, I believe you have a cycle consuming memory infinitely. This might be caused by some bug, or some loop in your custom code.

Are you doing any changes manually, from code? Only in the “custom” folder, I assume, or also directly in “modules”?

If you can get a Stack trace of that memory error, it would be extremely useful.

Hi pgr,

No i am doing no code modification at all
Try to create a package and module via module builder and load it via module loader after having published it. Nothing more :slight_smile:

I am working with SugarCRM for multiple years now, I am used to custom/upgrade safe customization, but for an unknown reason the module/beans seems to crash my MAMP install. That’s why i am asking for any other feedback. I will also have to test on latest SugarCE build to see if this is related to Suite specifically or not.

I’ll try to find the stacktrace tomorrow morning, i have first to understand why the code is crashing on the first custom relationship repair (maybe it is infinite looping when trying to load the custom definition ?) What is really strange is that I can reproduce it just using basic UI features like Module Builder/Loader (this is not a developper bug where I would have specifically hardcode a include/require loop or something strange like that)

Sequel of my in-deep study
Both actions are concerned by a single Suitecrm file /modules/Administration/RebuildRelationship.php

This file contain a loop (looping on $GLOBALS[“BeanFiles”]
debugging the lists : it contails ALL basic modules of SuiteCRM + at the end the loaded module (“SampleLicenceAddon”)

I tried to tweak the list by removing ALL entries except the last one : and it is still crashing on memory exhausted.
So this is not related to the length of loop, there’s something inside this module (I remind you that you can reproduce even by creating a new module from scratch by module loader) that causes SuiteCRM code to have a memory leak.

Exact line of code causing the problem :

/modules/Administration/Rebuildrelationship.php : 66

Not a surprise, SuiteCRM is crashing when trying to instanciate the bean to retrieve one instance…

There’s no constructor inside the child module
but it implements SugarBean, so we should refer to SugarBean.php parent class : /Data/SugarBean.php:429

Setting up multiple die lines of code, I isolated the problem line 439 :
VardefManager::loadVardef($this->module_dir, $this->object_name);

this refers to /include/SugarObjects/VardefManager.php (line 444) :
VardefManager::refreshVardefs($module, $object, null, true, $params);

Function refreshVardefs is located line 252
This function try to locate vardefs.php file (but there’s no such file inside the SampleLicenceAddon.php ZIP file provided by SuiteCRM)
And inside we have line 277 : BeanFactory::newBean($module);

BeanFactory is located in /data/BeanFactory.php, function NewBean (125) only returns result of function getBean (line 78)

function getBean, line 115 :
$bean = new $beanClass();

So my constructor is calling a method that is calling a method that at the end, try to call… the constructor ! infinite loop ! Bingo !

======

All problems are caused only by a missing vardefs.php file inside the new module !
As this ZIP file is managed directly by SugarOutfitters/SuiteOutfitters, I will report to Jason the problem.

Nice detective work…

We should really fix two separate things:

  • make sure the vardefs file is created if it is really necessary

  • make sure that a missing vardefs file does not create an infinite loop! :ohmy:

When you find out more about this issue you should create an entry for it on Github, I think it will be a nice contribution, especially if at that moment you can already include a fixQ

I double check the module loader zip file produced by Suitecrm and it contains the vardefs.php file so my initial post was wrong.
The problem is only located with SuiteCRM addons (outfitters licencing code) as the sampleLicenceAddon file provided does not contain the vardefs.php file necessary to work on SuiteCRM 7.10

I emailed Jason this morning in order to let him know results of my tests and I will wait for his answer.

Regarding the issue of infinite looping, you’re right that I should maybe open an issue on github to let the team know.

1 Like