Symfony Monolog container error once every 500 requests - php

Since upgrading to PHP 8.1, Symfony 6.1, Monolog 3.2, I have been seeing a PHP fatal error while constructing the Symfony DI container:
2022/12/12 04:10:02 [error] 31#31: *919 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught TypeError: Monolog\Logger::getLevelName(): Argument #1 ($level) must be of type Monolog\Level|int, Symfony\Bridge\Monolog\Handler\ConsoleHandler given, called in /app/vendor/monolog/monolog/src/Monolog/Logger.php on line 196 and defined in /app/vendor/monolog/monolog/src/Monolog/Logger.php:437
Stack trace:
#0 /app/vendor/monolog/monolog/src/Monolog/Logger.php(196): Monolog\Logger::getLevelName()
#1 /app/var/cache/prod/ContainerOqglp2q/App_KernelProdContainer.php(1441): Monolog\Logger->pushHandler()
#2 /app/var/cache/prod/ContainerOqglp2q/App_KernelProdContainer.php(1103): ContainerOqglp2q\App_KernelProdContainer->getMonolog_Logger_RequestService()
#3 /app/vendor/symfony/dependency-injection/Container.php(218): ContainerOqglp2q\App_KernelProdContainer->getHttpKernelService()
#4 /app/vendor/symfony/dependency-injection/Container.php(198): Symfony\Component\DependencyInjection\Container->make()
#5 /app/vendor/symfony/http-kernel/Kernel.php(195): Symfony\Compone" while reading response header from upstream, client: 172.27.0.16, server: _, request: "POST /job-engine-client/execute HTTP/1.0", upstream: "fastcgi://192.168.64.5:9000", host: "x"
I have not been able to reproduce the error manually, as it only happens in my staging environment, and very inconsistent.
It is currently only visible in HTTP requests triggered by a cronjob every 5 minutes. In the past 4 days, it only happened 2 times.
The application is deployed using docker compose, with a custom Ubuntu Dockerfile.
The application is deployed to multiple hosts, and shows the same random occurence of errors on each host.
When looking at the Monolog Logger.php file, it is really hard to understand how the stack trace that is logged can be ever triggered.
I'm suspecting some kind of PHP opcache or JIT issue, or perhaps an issue with the docker filesystem returning some other cached (older) versions of files.
Has anyone seen similar errors, or perhaps other suggestions how to debug & resolve this issue?

Related

Phpmyadmin 500 internal server error with big number of tables

I have database with lots of tables in it, when I try to navigate the tables list I ma getting a 500 error from phpmyadmin
this is the related error in the apache log
[proxy_fcgi:error] [pid 14770] [client 94.130.127.152:20932] AH01071: Got error 'PHP message: PHP Fatal error: Uncaught TypeError: Argument 2 passed to PhpMyAdmin\\DatabaseInterface::dataSeek() must be of the type int, string given, called in /var/www/html/phpMyAdmin-5.0.1-all-languages/libraries/classes/Navigation/Nodes/NodeDatabase.php on line 488
and defined in /var/www/html/phpMyAdmin-5.0.1-all-languages/libraries/classes/DatabaseInterface.php:2730
Stack trace:
#0 /var/www/html/phpMyAdmin-5.0.1-all-languages/libraries/classes/Navigation/Nodes/NodeDatabase.php(488): PhpMyAdmin\\DatabaseInterface->dataSeek()
#1 /var/www/html/phpMyAdmin-5.0.1-all-languages/libraries/classes/Navigation/Nodes/NodeDatabase.php(514): PhpMyAdmin\\Navigation\\Nodes\\NodeDatabase->getTablesOrViews()
#2 /var/www/html/phpMyAdmin-5.0.1-all-languages/libraries/classes/Navigation/Nodes/NodeDatabase.php(373): PhpMyAdmin\\Navigation\\Nodes\\NodeDatabase->getTables()
#3 /var/www/html/phpMyAdmin-5.0.1-all-languages/libraries/classes/Navigation/NavigationTree.php(400): PhpMyAdmin\\Navigation\\Nodes\\NodeDatabase->getDa...'
centos7
php7.4
directadmin 1.6
mysql 5.7
php1_release 5.6
php1_mode mod_php
php2_release 7.4
php2_mode php-fpm
my php1_release is php5.6 but since phpmyadmin required php7.2+ I manually changed the handler to point to the php 7.4 fpm socket
I am guesting that some resources are low on the php size which causing this error because its working just fine in my other server ...
so what config do I need to change?
Tanks to #MagnusEriksson here is the solution :
https://github.com/phpmyadmin/phpmyadmin/issues/15772
https://github.com/phpmyadmin/phpmyadmin/commit/6981910c8c2c2fd1aaa515c2a37459e68a3740e3
in libraries/classes/Navigation/NavigationTree.php:129
$this->pos2Value[0] = (int) $_REQUEST['pos2_value'];
just add the cast to int

Doctrine settings for proxy

I'm programming a web application with Doctrine 2 on a CentOS 7 server, with Plesk and PHP 7.3.
I'm getting the error message that I have to configure a proxy directory when I run the web application. On my test system (local) it works without any issues.
What can I do to fix this problem?
Fatal error: Uncaught Doctrine\Common\Proxy\Exception\InvalidArgumentException: You must configure a proxy directory. See docs for details in /var/www/vhosts/.../vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php:23 Stack trace: #0 /var/www/vhosts/.../vendor/doctrine/common/lib/Doctrine/Common/Proxy/ProxyGenerator.php(199): Doctrine\Common\Proxy\Exception\InvalidArgumentException::proxyDirectoryRequired() #1 /var/www/vhosts/.../vendor/doctrine/orm/lib/Doctrine/ORM/Proxy/ProxyFactory.php(77): Doctrine\Common\Proxy\ProxyGenerator->__construct(false, 'Proxies') #2 /var/www/vhosts/.../vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(167): Doctrine\ORM\Proxy\ProxyFactory->__construct(Object(Doctrine\ORM\EntityManager), false, 'Proxies', 1) #3 /var/www/vhosts/.../vendor/doctrine/orm/lib/Doctrine/ORM/EntityManager.php(8 in /var/www/vhosts/.../vendor/doctrine/common/lib/Doctrine/Common/Proxy/Exception/InvalidArgumentException.php on line 23

Getting a Guzzle 401 error when deploying a composer enable site to production?

I have a site that uses composer to build the QA environment and then deploys the QA environment to production. Production does not have composer installed, instead the vendor folder is synced between the two environments. On my last project I had to update the composer.lock file. When i deployed the project, i received the following error:
PHP Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: GET https://www.myurl.com resulted in a 401 Unauthorized response:
Unauthorized.
in my_file_system/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:113
Stack trace:
#0 my_file_system/vendor/guzzlehttp/guzzle/src/Middleware.php(66): GuzzleHttp\Exception\RequestException::create(Object(GuzzleHttp\Psr7\Request), Object(GuzzleHttp\Psr7\Response))
#1 my_file_system/vendor/guzzlehttp/promises/src/Promise.php(203): GuzzleHttp\Middleware::GuzzleHttp\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 my_file_system/vendor/guzzlehttp/promises/src/Promise.php(156): GuzzleHttp\Promise\Promise::callHandler(1, Object(GuzzleHttp\Psr7\Response), Array)
#3 my_file_system/vendor/guzzlehttp/promises/src/TaskQueue.php(47): GuzzleHttp\Promise\Promise::GuzzleHttp\Promise\{closure}()
#4 my_file_system/ in my_file_system/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php on line 113, referer:
The error is happening during an JQuery AJAX call. Any deployment that i do to a system that has composer seems to work correctly, it is only when the system does not have the ability to run composer commands that error is seen.
I have been unable to duplicate the issue in a testing environment up to this point and can test in production.
The issue ended up being an incorrect value in the .env file.

Mantis SOAP-Error accessing mantisconnect.php (Eclipse Mylyn-Plugin)

I installed Mantis BT 1.2.19 on my server and it works well. To benefit from it in my Eclipse-IDE (Mars) I installed the Task-Repo Plugin for Mantis and tried to add the connection.
When I click on "Validate settings" in Eclipse I get the following error:
SOAP-ERROR: Parsing WSDL: Couldn't load from '/var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.wsdl' : failed to load external entity "/var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.wsdl"
In my error-log on the server are the following entries
[14-Oct-2015 11:25:05 Europe/Berlin] [mantisconnect.php] Error Type: SYSTEM WARNING,
Error Description: SoapServer::SoapServer(): I/O warning : failed to load external entity "/var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.wsdl"
Stack Trace:
mantisconnect.php L121 SoapServer(<string>'mantisconnect.wsdl', <Array> { ['features'] => 5 })
[14-Oct-2015 11:25:05 Europe/Berlin] PHP Warning: Uncaught SoapFault exception: [Server] Error Type: SYSTEM WARNING,
Error Description: SoapServer::SoapServer(): I/O warning : failed to load external entity "/var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.wsdl" in /var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mc_api.php:107
Stack trace:
#0 /var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mc_api.php(530): SoapActions::sendSoapFault('Server', 'Error Type: SYS...')
#1 [internal function]: mc_error_handler(2, 'SoapServer::Soa...', '/var/www/vhosts...', 121, Array)
#2 /var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.php(121): SoapServer->SoapServer('mantisconnect.w...', Array)
#3 {main}
thrown in /var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mc_api.php on line 107
[14-Oct-2015 11:25:05 Europe/Berlin] PHP Fatal error: SOAP-ERROR: Parsing WSDL: Couldn't load from '/var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.wsdl' : failed to load external entity "/var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.wsdl"
in /var/www/vhosts/{myhost}/httpdocs/mantis/api/soap/mantisconnect.php on line 121
The errors above are produced by the Mantis plugin on accessing the URL
188.109.171.76 - - [14/Oct/2015:11:25:05 +0200] "POST /mantis/api/soap/mantisconnect.php HTTP/1.0" 500 1067 "-" "Mylyn/3.17.0 Mylyn-Mantis Connector/3.10.1 Apache Axis/1.4 Eclipse (org.eclipse.epp.package.jee.product) HttpClient/3.1 Java/1.8.0_60 (Oracle) Windows 7/6.1 (amd64; de_DE)"
But even a "normal" GET-access to the URL mentioned above produces the same error
https://{myhost}/mantis/api/soap/mantisconnect.php
No error is produced on accessing
https://{myhost}/mantis/api/soap/mantisconnect.php?wsdl
To solve the problem on my own I checked several ideas:
The file IS existant ... {myhost} is just a placeholder here obviously - placed by me
I switched to the context of the webserver www-data and tried accessing the file ... it IS accessible
So I´ve no idea...
PHP version is 5.5.9-1ubuntu4.13 on Ubuntu 14.04.3 LTS
€dit:
Tracked down the error to the following PHP-line in mantis/api/soap/mantisconnect.php
$server = new SoapServer("mantisconnect.wsdl",
array('features' => SOAP_USE_XSI_ARRAY_TYPE + SOAP_SINGLE_ELEMENT_ARRAYS)
);
I don´t understand why there an error is thrown - because as I said: it exists and is readable by the webserver...
€edit2:
I replaced the line
$server = new SoapServer("mantisconnect.wsdl",
with
$server = new SoapServer("http://{myhost}/mantis/api/soap/mantisconnect.wsdl",
THIS works... so I´ve a "solution" but I don´t know why the access via file does not work
I Think I found the answere on my own (my workaround failed some hours later - with same error again).
Seems to be a bug in PHP (on Ubuntu) as mentioned here
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/1160336
Unresolved since 2013
:-(
My current workaround is disabling soap.wsdl_cache_enabled in php.ini which seems to help for the moment.

Failed to create COM object `WScript.shell': CoInitialize has not been called

At sometime today, this error occurred and the script hanged:
[21-Aug-2013 08:35:06] PHP Fatal error: Uncaught exception 'com_exception' with message 'Failed to create COM object `WScript.shell': CoInitialize has not been called.
' in C:\path\to\my\script.php:357
Stack trace:
#0 C:\path\to\my\script.php(357): com->com('WScript.shell')
#1 {main}
thrown in C:\path\to\my\script.php on line 357
This is the line (running in a loop) causing the error:
$com = new Com('WScript.shell');
This line usually runs fine so I'm not missing any libraries. Why could this happen ?
Go to php.ini and add this line. After that, restart php server. Good luck to you
extension=php_com_dotnet.dll
That is most likely due to desktop heap allocation error. One way to verify is to go to Windows Event Log (system category) and search for "desktop heap allocation failed" error or warning. As an workaround, you can consider using shell_exec.
For more details about desktop heap allocation error, see KB 184802
Effectively include the library "extension = php_com_dotnet.dll" in php.ini can serve in executing $ command = new Com ('WScript.Shell');
in my case it worked with Apache / 2.2.29 server (Win64) PHP / 3.5.29 mod_ssl / 2.2.29
thanks a lot.

Categories