mysql howto find / debug error "mysqld got signal 11 ;" - php

Hope somebody can help here. We're running a MySQL Server (5.7.18-0ubuntu0.17.04.1), only a single application. A few clients connected pushing and pulling data from and into the database.
Sometimes, it goed all well for a long time... up to hours. Sometime, we're getting errors like
PHP Warning: mysqli::__construct(): (HY000/2002): Connection refused
or
PHP Warning: mysqli::query(): MySQL server has gone away
or
PHP Warning: mysqli::query(): Error reading result set's header
and
PHP Fatal error: Uncaught TypeError: Return value of mysqliConnection::escapeValue() must be of the type string, null returned
Errors above (At least the fatal errors), causes apache to exit with a 500-status-error. Not so good for our clients.
After searching, we found out all are mysql-related. Searching in the mysql-logs, gave us the mysqld got signal 11 ;. We're want to find out why this error / signal happens, but can't really find it. Tried a bunch of mysql-settings in my.cnf already, but doesn't seem to fix the issue.
See also these log-lines at pastbin: https://pastebin.com/GWDADudL
How can we find out what causes this error? Already used mysql.log to find out if it happens at a specific query, but seems to be random. Most tables are MyISAM, some InnoDB. Also had a MEMORY-table, but it's MyISAM now.
Help? Please? There seems to be something wrong, but what?

Related

Errors destroying and reading sessions in PHP

I have a PHP 7 app that works well on all servers it's installed on except one. All servers are Windows (I believe server 2008 R2 and 2012). The problem is that on one of the servers, we keep getting two kinds of errors sporadically, seemingly randomly. One of the errors is
session_destroy(): Session object destruction failed
and the other is
PHP Fatal error: Uncaught exception 'ErrorException' with message 'Unknown: open(E:\tmp\sess_6qlo69vbii0qs65i4n47blafi3, O_RDWR) failed: Permission denied (13)' in Unknown:0
Every search I do on these errors go back to permissions, which makes sense aside from the fact that it's not happening every time, it's random. What am I missing here, could anything cause the permissions on the file to be different when the session gets created for some reason in certain situations? Or anything else that could possibly explain this behavior?

PHP (5.5.7) Warning connecting to MySQLi in Windows Servers 2008 R2

I'm running Moodle on PHP 5.5.7 64bit nts on Windows Server 2008 R2 with MySQL 5.5.36.
Up until two days ago, there were no problems. To deal with Xdebugger being such a memory hog, an extra CPU and more memory was assigned to the virtual machine. The Windows license was also activated. The entire vm was rebooted. (I had restarted the machine before prior to this, with no problems).
I am now receiving the following warning when I access any page on the site:
PHP Warning: mysqli::mysqli(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
in C:\inetpub\wwwroot\moodle\lib\dml\mysqli_native_moodle_database.php on line 375
I created a test php page that simply consists of the following:
$mysqli = new mysqli("127.0.0.1", "moodleuser", 'xxxx', "moodle", 3306);
if ($result = $mysqli->query("SELECT * from mdl_user limit 10")) {
echo "Select returned $result->num_rows";
} else {
echo "Error";
}
$mysqli->close();
I receive the following output:
PHP Warning: mysqli::mysqli(): (HY000/2002): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.in C:\inetpub\wwwroot\moodle\info.php on line 17
PHP Warning: mysqli::query(): Couldn't fetch mysqli in C:\inetpub\wwwroot\moodle\info.php on line 18
PHP Warning: mysqli::close(): Couldn't fetch mysqli in C:\inetpub\wwwroot\moodle\info.php on line 24
I have checked that "127.0.0.1 localhost" exists in my hosts file and that the IPv6 "::1" line has been commented out.
I have also attempted to use "localhost" but same problem.
The bizarre thing is that if I refresh the page, occasionally, and completely at random, the warning doesn't occur and the correct output is given.
I have attempted to disable the warnings, but php appears to be ignoring me. Also, disabling the warning is not exactly ideal.
Any ideas?
EDIT:
So after much pain staking back and forths between PHP and MySQL and IIS, it looks like (once again) it was php.ini to blame.
To be honest, I cant even tell you which setting was the problem - but I changed all possible timeout related settings in php.ini to a large number (10000 or -1 depending on the setting), as well as the connection_timeout for mysql in my.ini.
I am still yet to figure out which one was causing the problem, but will edit this post if I ever do.
So after much pain staking back and forths between PHP and MySQL and IIS, it looks like (once again) it was php.ini to blame.
To be honest, I cant even tell you which setting was the problem - but I changed all possible timeout related settings in php.ini to a large number (10000 or -1 depending on the setting), as well as the connection_timeout for mysql in my.ini.
I am still yet to figure out which one was causing the problem, but will edit this post if I ever do.

Mongo Cursor Exception: Timeout Waiting for Header Data

My company recently added MongoDB to the databases that we use and things have been going mostly smoothly, but every once in a while we get an odd error. It is near impossible to duplicate, and has only happened four times in the last week of testing, but once we go live to production our clients will be using the site much more frequently than we were for testing. We are trying to solve the bug before it gets out of hand.
The error we get is: (line breaks added for readability)
Fatal error: Uncaught exception 'MongoCursorException' with message
'Failed to connect to: 10.0.1.114:27017: send_package: error reading from socket:
Timed out waiting for header data' in
/opt/local/apache2/htdocs/stage2/library/Shanty/Mongo/Connection/Group.php on line 134
We are using ShantyMongo in PHP and it is a remote connection. The error is really intermittent, and refreshing the page is enough to get it to go away. As a temporary solution, we have wrapped all of our mongo methods in a for...try/catch so that if a MongoException is thrown we retry the method up to two more times, the hope being that it will succeed one of the three attempts since the error is so unpredictable.

More than max_user_connections in CodeIgniter app?

I'm getting what looks like rather serious database errors in my CodeIgniter application. In the log file it says:
User anders already has more than 'max_user_connections' active connections
And there are several hundred of those lines... I've read a bit by Googling, and some suggested that it was because you didn't close the connection after it was used, but others said that this was nonsense, and that the connection was automatically closed (which is what I read in the docs too).
Also, later in the log file, I have these error messages:
ERROR - 2011-10-12 10:50:19 --> Severity: Warning --> file_get_contents(http://localhost/expertinfo/error/error_general) [function.file-get-contents]: failed to open stream: HTTP request failed! /Applications/MAMP/htdocs/expertinfo/application/errors/error_general.php 4
This seems to have something to do with the fact that I'm using a custom error page by using
echo file_get_contents($config['base_url'] . 'error/error_db');
to redirect to a custom page.
Finally, I'm also getting:
ERROR - 2011-10-12 10:52:19 --> Severity: Warning --> mysql_pconnect() [function.mysql-pconnect]: Can't connect to MySQL server on 'mydb24.surftown.se' (4) /Applications/MAMP/htdocs/expertinfo/system/database/drivers/mysql/mysql_driver.php 88
In these last two, I don't understand what the local path is doing there (The path to my CodeIgniter app on my computer). I mean this is a part of the system folder and the one on the remote server should be used, right? I have the database set up as the remote database, and I don't have any local paths as far as I know....
So why does this happen, and what can I do about it?
Please help, this seems rather urgent. I'm a bit of a newbie to both php and CodeIgniter too, so a clear and simple answer would be greatly appreciated!
Local path as I see shows you file where your error happened, because your driver /Applications/MAMP/htdocs/expertinfo/system/database/drivers/mysql/mysql_driver.php possible on it's 88 line contain connect() function and it raise an exception
The problem is with your mydb24.surftown.se remote server, you should check your access credentials, etc. to find what exactly happened
Just an FYI, mysql_pconnect is usually a bad practice on shared hosting (you can see why here:http://stackoverflow.com/questions/1830830/advantages-disadvantages-of-pconnect-option-in-codeigniter)
You might just disable pconnect on application/config/database.php and see the error going away as your connections will be realluy lower.
For the quote: "mysql_pconnect is usually a bad practice on shared hosting".
I changed to use mysql_connect. It made no difference.

PHP MySQLi query - "Permission denied" [duplicate]

This question already has an answer here:
Connect DATABASE Error TYPE: 2002: Permission denied
(1 answer)
Closed 3 years ago.
Im using PHP MySQLi to connect to MySQL and sometimes doing query i get error:
"Permission denied" error code: 2002.
The strange thing is that it happens for different query's and totally unpredictable. For example it might happen on third query after first two executed correctly.
I know it is not problem with MySQL because i moved it from one server to another and problem still persists. Most likely problem with PHP or interconnection between PHP and MySQL servers (they're on different machines)
Anyone got ideas?
EDIT:
query what gets "Permission denied" works if i restart script - its not permissions problem
ERROR:
[23-Apr-2011 19:00:02] PHP Warning:
mysqli::mysqli() [mysqli.mysqli]:
[2002] Permission denied (trying to
connect via
tcp://xxx.xxx.xxx.xxx:3306) in
/home/.../DB.php on line 19
[23-Apr-2011 19:00:02] PHP Warning:
mysqli::mysqli() [mysqli.mysqli]:
(HY000/2002): Permission denied in
/home/.../DB.php on line 19
Same things happened on my environment. And the cause was SELinux.
You might be able to connect the database by executing php from command line
while you might not by executing on the web server.
In my case, I turned off SELinux.
# setenforce 0
Or you have to set up SELinux correctly.
I think the database user do not have sufficient permission to make particular operation on particular mysql table.
This isn't a permissions error. The client isn't able to get as far as connecting to the database, let alone trying to authenticate the user.
I suspect these problems will be being caused by either network problems (preventing the client/server machines from talking to each other) or the MySQL server process not running on the remote host.
The error code is documented here: http://dev.mysql.com/doc/refman/5.5/en/can-not-connect-to-server.html
Check The Permissions for the user that you are connected through

Categories