From e80dcd506b14836c16eb9cb2c30ffe97e85b38f3 Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Mon, 30 Mar 2015 15:02:48 -0400 Subject: [PATCH 1/2] PM-1903 "0017014: ProcessMaker loses connection..." SOLVED Issue: 0017014: ProcessMaker loses connection with database -> lack of mysql_close() Cause: - Error al tratar de conectarse a la BD - Segun el feedback proporcianado, el problema central se basa en que no se esta haciendo uso del mysql_close() Solution: - Se a logrado implementar el close de los connects a BD abiertos - Este cambio repercute en toda la funcionalidad de ProcessMaker. Por lo que se debera hacer un test con todos los flags de depuracion habilitados, tambien con todos los plugins habilitados/deshabilitados - Tambien se debe considerar otros "test cases" --- gulliver/thirdparty/propel/Propel.php | 28 +++++++++++++++------------ workflow/public_html/app.php | 13 ++++++++++++- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/gulliver/thirdparty/propel/Propel.php b/gulliver/thirdparty/propel/Propel.php index 4cf122349..a28a85c00 100755 --- a/gulliver/thirdparty/propel/Propel.php +++ b/gulliver/thirdparty/propel/Propel.php @@ -596,16 +596,20 @@ class Propel { * * @return void */ - public static function close() - { - $last = ''; - foreach(self::$connectionMap as $conn) { - if ($last != $conn->lastQuery) { - $conn->close(); - } - $last = $conn->lastQuery; - } - } + public static function close() + { + $lastQuery = ""; + + foreach (self::$connectionMap as $cnn) { + if (!($cnn instanceof DBArrayConnection)) { + if (gettype($cnn->getResource()) == "resource" && $cnn->isConnected() && $cnn->lastQuery != $lastQuery) { + $cnn->close(); + } + + $lastQuery = $cnn->lastQuery; + } + } + } /** * @param $name string The connection name @@ -622,7 +626,7 @@ class Propel { /*----------------------------------********---------------------------------*/ } /*----------------------------------********---------------------------------*/ - + if (! empty(self::$configuration['datasources'][$name]['connection'])) { return self::getConnection($name); } @@ -630,7 +634,7 @@ class Propel { // the connection names always should be have a underscore like: workflow_ro, rbac_rw // on fallback, we will try found a connection named: "workflow" if "workflow_ro" does not exist. // the name without the "_ro" part. - + $defaultDbName = substr($name, 0, strrpos($name, '_')); if (! empty(self::$configuration['datasources'][$defaultDbName]['connection'])) { diff --git a/workflow/public_html/app.php b/workflow/public_html/app.php index 5530a8cb9..63738c8c7 100644 --- a/workflow/public_html/app.php +++ b/workflow/public_html/app.php @@ -1,4 +1,15 @@ add($rootDir . 'workflow/engine/src/', "ProcessMaker"); $loader->add($rootDir . 'workflow/engine/src/'); - + // add vendors to autoloader $loader->add($rootDir . 'vendor/luracast/restler/vendor', "Luracast"); $loader->add($rootDir . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2"); From e37390d85aa1b0d7e09097380d23ce01a640865d Mon Sep 17 00:00:00 2001 From: Victor Saisa Lopez Date: Tue, 31 Mar 2015 09:34:40 -0400 Subject: [PATCH 2/2] PM-1903 "0017014: ProcessMaker loses connection..." SOLVED Issue: 0017014: ProcessMaker loses connection with database -> lack of mysql_close() Cause: - Error al tratar de conectarse a la BD - Segun el feedback proporcionado, el problema central se basa en que no se esta haciendo uso del mysql_close() Solution: - Se a logrado implementar el close de los connects a BD abiertos - Este cambio repercute en toda la funcionalidad de ProcessMaker. Por lo que se debera hacer un test con todos los flags de depuracion habilitados, tambien con todos los plugins habilitados/deshabilitados - Tambien se debe considerar otros "test cases" --- workflow/engine/bin/cron_single.php | 11 +++++++++++ workflow/engine/bin/messageeventcron_single.php | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/workflow/engine/bin/cron_single.php b/workflow/engine/bin/cron_single.php index 3ea41dd34..167444a20 100755 --- a/workflow/engine/bin/cron_single.php +++ b/workflow/engine/bin/cron_single.php @@ -1,4 +1,15 @@