Getting errorException "Too many connections"
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 28
- Joined: 21 May 2019, 09:52
Getting errorException "Too many connections"
Hi,
I am getting an exception randomly like ErrorException (E_ERROR)
An exception occurred in driver: SQLSTATE[HY000] [1040] Too many connections
in my 'frontpanel_nav.blade.php' file.
This happens randomly on any page of the site. Sometimes the same page runs smoothly as usual but sometimes this exception appears on the same page.
Thanks
Harpal Singh
I am getting an exception randomly like ErrorException (E_ERROR)
An exception occurred in driver: SQLSTATE[HY000] [1040] Too many connections
in my 'frontpanel_nav.blade.php' file.
This happens randomly on any page of the site. Sometimes the same page runs smoothly as usual but sometimes this exception appears on the same page.
Thanks
Harpal Singh
Re: Getting errorException "Too many connections"
If you have overwritten any classes, please make sure you have as release() for each acquire(), even on exceptions.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 28
- Joined: 21 May 2019, 09:52
Re: Getting errorException "Too many connections"
I havn't extended any class but using calling some header functions in my files like :
and I think there is problem in these functions.
Thanks
Harpal Singh
Code: Select all
/** To Get language and Currency **/
function getLocaleCurrency()
{
$arr = [];
$context = app( '\Aimeos\Shop\Base\Context')->get();
$locale = $context->getLocale();
$arr['language'] = $locale->getLanguageId();
$arr['currency'] = $locale->getCurrencyId();
$arr['site'] = $locale->getSite();
return $arr;
}
function getCategoryByProductId($id) {
$context = app('\Aimeos\Shop\Base\Context')->get();
/** @var \Aimeos\MShop\Catalog\Manager\Standard $manager */
$manager = \Aimeos\MShop\Catalog\Manager\Factory::createManager( $context );
$search = $manager->createSearch( true );
$expr = array(
$search->compare('==', 'catalog.lists.refid', $id),
$search->compare('==', 'catalog.lists.domain', 'product'),
);
$search->setConditions($search->combine('&&', $expr));
$categoryItems = $manager->searchItems($search);
return $categoryItems;
}
etc.
How can I release connection? I mean What is syntax for it.If you have overwritten any classes, please make sure you have as release() for each acquire(), even on exceptions.
Code: Select all
Aimeos\MW\DB\Exception thrown with message "An exception occurred in driver: SQLSTATE[HY000] [1040] Too many connections"
Stacktrace:
#69 Aimeos\MW\DB\Exception in /vendor/aimeos/aimeos-core/lib/mwlib/src/MW/DB/Manager/DBAL.php:114
#68 Aimeos\MW\DB\Manager\DBAL:acquire in /vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Manager/Base.php:83
#67 Aimeos\MShop\Common\Manager\Base:createSearch in /vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Catalog/Manager/Standard.php:269
#66 Aimeos\MShop\Catalog\Manager\Standard:createSearch in /vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Manager/Base.php:302
#65 Aimeos\MShop\Common\Manager\Base:createSearchBase in /vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Catalog/Manager/Standard.php:266
#64 Aimeos\MShop\Catalog\Manager\Standard:createSearch in /vendor/aimeos/aimeos-core/lib/mshoplib/src/MShop/Common/Manager/Decorator/Base.php:88
#63 Aimeos\MShop\Common\Manager\Decorator\Base:createSearch in /app/Helper/helper.php:2120
#62 getCategoryByProductId in /ext/azx/client/html/templates/catalog/detail/body-standard.php:207
#61 include in /vendor/aimeos/aimeos-core/lib/mwlib/src/MW/View/Standard.php:251
#60 Aimeos\MW\View\Standard:includeFile in /vendor/aimeos/aimeos-core/lib/mwlib/src/MW/View/Standard.php:233
#59 Aimeos\MW\View\Standard:render in /ext/ai-client-html/client/html/src/Client/Html/Catalog/Detail/Standard.php:192
#58 Aimeos\Client\Html\Catalog\Detail\Standard:getBody in /vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Base/Page.php:91
#57 Aimeos\Shop\Base\Page:getSections in /vendor/aimeos/aimeos-laravel/src/Aimeos/Shop/Controller/CatalogController.php:46
#56 Aimeos\Shop\Controller\CatalogController:detailAction in /vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
#55 call_user_func_array in /vendor/laravel/framework/src/Illuminate/Routing/Controller.php:54
#54 Illuminate\Routing\Controller:callAction in /vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php:45
#53 Illuminate\Routing\ControllerDispatcher:dispatch in /vendor/laravel/framework/src/Illuminate/Routing/Route.php:212
#52 Illuminate\Routing\Route:runController in /vendor/laravel/framework/src/Illuminate/Routing/Route.php:169
#51 Illuminate\Routing\Route:run in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:665
#50 Illuminate\Routing\Router:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
#49 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php:41
#48 Illuminate\Routing\Middleware\SubstituteBindings:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#47 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#46 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php:68
#45 Illuminate\Foundation\Http\Middleware\VerifyCsrfToken:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#44 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#43 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php:49
#42 Illuminate\View\Middleware\ShareErrorsFromSession:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#41 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#40 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php:63
#39 Illuminate\Session\Middleware\StartSession:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#38 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#37 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php:37
#36 Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#35 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#34 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php:66
#33 Illuminate\Cookie\Middleware\EncryptCookies:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#32 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#31 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
#30 Illuminate\Pipeline\Pipeline:then in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:667
#29 Illuminate\Routing\Router:runRouteWithinStack in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:642
#28 Illuminate\Routing\Router:runRoute in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:608
#27 Illuminate\Routing\Router:dispatchToRoute in /vendor/laravel/framework/src/Illuminate/Routing/Router.php:597
#26 Illuminate\Routing\Router:dispatch in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:176
#25 Illuminate\Foundation\Http\Kernel:Illuminate\Foundation\Http\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:30
#24 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/spatie/laravel-cookie-consent/src/CookieConsentMiddleware.php:12
#23 Spatie\CookieConsent\CookieConsentMiddleware:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#22 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#21 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /app/Http/Middleware/SetLocale.php:99
#20 App\Http\Middleware\SetLocale:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#19 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#18 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/fideloper/proxy/src/TrustProxies.php:57
#17 Fideloper\Proxy\TrustProxies:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#16 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#15 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
#14 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#13 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#12 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php:31
#11 Illuminate\Foundation\Http\Middleware\TransformsRequest:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#10 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#9 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php:27
#8 Illuminate\Foundation\Http\Middleware\ValidatePostSize:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#7 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#6 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php:62
#5 Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode:handle in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:151
#4 Illuminate\Pipeline\Pipeline:Illuminate\Pipeline\{closure} in /vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php:53
#3 Illuminate\Routing\Pipeline:Illuminate\Routing\{closure} in /vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php:104
#2 Illuminate\Pipeline\Pipeline:then in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:151
#1 Illuminate\Foundation\Http\Kernel:sendRequestThroughRouter in /vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php:116
#0 Illuminate\Foundation\Http\Kernel:handle in /public/index.php:66
Harpal Singh
Re: Getting errorException "Too many connections"
Is this a dev or production environment?
The Aimeos methods are usually save and use acquire() and release() symetrically. They also case about exceptions. You can check if you add a debug statement to the acquire() and release() methods of \Aimeos\MW\DB\Manager\DBAL (https://github.com/aimeos/aimeos-core/b ... r/DBAL.php) and compare acquire/release pairs.
The Aimeos methods are usually save and use acquire() and release() symetrically. They also case about exceptions. You can check if you add a debug statement to the acquire() and release() methods of \Aimeos\MW\DB\Manager\DBAL (https://github.com/aimeos/aimeos-core/b ... r/DBAL.php) and compare acquire/release pairs.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 28
- Joined: 21 May 2019, 09:52
Re: Getting errorException "Too many connections"
I have checked my .env and APP_ENV = local and APP_DEBUG=true.
Should I change APP_ENV to production and APP_DEBUG=false to fix the problem?
Thanks
Harpal Singh
Should I change APP_ENV to production and APP_DEBUG=false to fix the problem?
Thanks
Harpal Singh
Re: Getting errorException "Too many connections"
No, reconfiguring APP_ENV won't help. You should add an error_log() output to acquire() and release() to see if they are symetrically called.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 28
- Joined: 21 May 2019, 09:52
Re: Getting errorException "Too many connections"
Where should I use error_log() and how, can you please brief?aimeos wrote:No, reconfiguring APP_ENV won't help. You should add an error_log() output to acquire() and release() to see if they are symmetrically called.
-
- Posts: 28
- Joined: 21 May 2019, 09:52
Re: Getting errorException "Too many connections"
Hi,
I am stuck on this error. Now, this is happening very frequently. Unable to debug the issue where it is.
What do you suggest how to debug the problem and what can be a solution?
Thanks
Harpal Singh
I am stuck on this error. Now, this is happening very frequently. Unable to debug the issue where it is.
What do you suggest how to debug the problem and what can be a solution?
Thanks
Harpal Singh
Re: Getting errorException "Too many connections"
You problem might be somewhere else like stated in the other post
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star