Hi there this is making me crazy. Every time I try to enable the module and go to the status screen it is crashing my MySQL server.

I would love to get the extra benefits that I think this module would give for now as well as when I move to a new server however it has me baffled.

Thanks in advance.

My setup is as follows:

Ran Optimizations per http://goo.gl/30yi39
Centos 5.11 i686
MySQL 5.6.23
PHP 5.5.27

[PHP Modules]
bcmath
calendar
Core
ctype
curl
date
dom
ereg
filter
ftp
gd
geoip
geos
hash
iconv
imap
json
libxml
mbstring
mcrypt
memcache
mysql
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
pdo_sqlite
Phar
posix
Reflection
session
SimpleXML
sockets
solr
SPL
sqlite3
standard
tokenizer
uploadprogress
xml
xmlreader
xmlwriter
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache

mysqlnd 5.0.11-dev - 20120503
Loaded plugins mysqlnd,debug_trace,auth_plugin_mysql_native_password,auth_plugin_mysql_clear_password,auth_plugin_sha256_password
API Extensions mysqli,mysql,pdo_mysql

my.cnf

[mysql]

# CLIENT #
port = 3306
socket = /var/lib/mysql/mysql.sock

[mysqld]

# GENERAL #
user = mysql
default-storage-engine = InnoDB
socket = /var/lib/mysql/mysql.sock
pid-file = /var/lib/mysql/mysql.pid

# MyISAM #
key-buffer-size = 32M
myisam-recover = FORCE,BACKUP

# SAFETY #
max-allowed-packet = 32M
transaction-isolation = READ-COMMITTED
max-connect-errors = 1000000
skip-name-resolve
sql-mode = STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION,NO_ZERO_DATE,NO_ZERO_IN_DATE,ONLY_FULL_GROUP_BY
sysdate-is-now = 1
innodb = FORCE
innodb-strict-mode = 1

# DATA STORAGE #
datadir = /var/lib/mysql/

# BINARY LOGGING #
log-bin = /var/lib/mysql/mysql-bin
expire-logs-days = 7
sync-binlog = 1
binlog_format = MIXED

# CACHES AND LIMITS #
tmp-table-size = 32M
max-heap-table-size = 32M
query-cache-type = 0
query-cache-size = 0
max-connections = 100
thread-cache-size = 50
open-files-limit = 65535
table-definition-cache = 4096
table-open-cache = 4096

# INNODB #
innodb-flush-method = O_DIRECT
innodb-log-files-in-group = 2
innodb-log-file-size = 128M
innodb-flush-log-at-trx-commit = 1
innodb-file-per-table = 1
innodb-buffer-pool-size = 1456M
innodb_flush_log_at_trx_commit = 2

# LOGGING #
log-error = /var/lib/mysql/mysql-error.log
log-queries-not-using-indexes = 1
slow-query-log = 1
slow-query-log-file = /var/lib/mysql/mysql-slow.log

Comments

Christopher Riley’s picture

To verify that it wasn't a contrib module conflict I disabled all of the contrib modules and still get the same result.

mikeytown2’s picture

Does mysql-error.log provide any details on whats crashing?

Sylense’s picture

I'm having the same issue. On my local mamp environment I'm running mysql 5.5.42 and it works fine. However, my production server is running mysql 5.6.23 and it crashes when trying to access the status report page.

mikeytown2’s picture

I'd guess it's related to MySQL permissions. Going to see what I can do. Any word on what the error message looks like?

Sylense’s picture

Here's what I get in my mysql-error.log after trying to load the status page

151006 14:56:27 mysqld_safe Number of processes running now: 0
151006 14:56:27 mysqld_safe mysqld restarted
2015-10-06 14:56:27 0 [Warning] options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --slow-query-log is not set
2015-10-06 14:56:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2015-10-06 14:56:27 21370 [Note] Plugin 'FEDERATED' is disabled.
2015-10-06 14:56:27 7f7781659720 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator.
2015-10-06 14:56:27 21370 [Note] InnoDB: Using atomics to ref count buffer pool pages
2015-10-06 14:56:27 21370 [Note] InnoDB: The InnoDB memory heap is disabled
2015-10-06 14:56:27 21370 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2015-10-06 14:56:27 21370 [Note] InnoDB: Memory barrier is not used
2015-10-06 14:56:27 21370 [Note] InnoDB: Compressed tables use zlib 1.2.3
2015-10-06 14:56:27 21370 [Note] InnoDB: Using CPU crc32 instructions
2015-10-06 14:56:27 21370 [Note] InnoDB: Initializing buffer pool, size = 384.0M
2015-10-06 14:56:27 21370 [Note] InnoDB: Completed initialization of buffer pool
2015-10-06 14:56:27 21370 [Note] InnoDB: Highest supported file format is Barracuda.
2015-10-06 14:56:27 21370 [Note] InnoDB: Log scan progressed past the checkpoint lsn 762422273911
2015-10-06 14:56:27 21370 [Note] InnoDB: Database was not shutdown normally!
2015-10-06 14:56:27 21370 [Note] InnoDB: Starting crash recovery.
2015-10-06 14:56:27 21370 [Note] InnoDB: Reading tablespace information from the .ibd files...
2015-10-06 14:56:29 21370 [Note] InnoDB: Restoring possible half-written data pages 
2015-10-06 14:56:29 21370 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 762422401565
2015-10-06 14:56:29 21370 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 
InnoDB: Apply batch completed
2015-10-06 14:56:30 21370 [Note] InnoDB: 128 rollback segment(s) are active.
2015-10-06 14:56:30 21370 [Note] InnoDB: Waiting for purge to start
2015-10-06 14:56:30 21370 [Note] InnoDB: 5.6.23 started; log sequence number 762422401565
2015-10-06 14:56:30 21370 [Note] Server hostname (bind-address): '*'; port: 3306
2015-10-06 14:56:30 21370 [Note] IPv6 is available.
2015-10-06 14:56:30 21370 [Note]   - '::' resolves to '::';
2015-10-06 14:56:30 21370 [Note] Server socket created on IP: '::'.
2015-10-06 14:56:30 21370 [Note] Event Scheduler: Loaded 0 events
2015-10-06 14:56:30 21370 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.23'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)

The page idles in loading status for about 3-5 minutes and then returns the Mysql has gone away messages

Additional uncaught exception thrown while handling exception.

Original

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SHOW VARIABLES LIKE 'socket'; Array ( ) in apdqc_requirements() (line 302 of /home/SITENAME/public_html/sites/all/modules/apdqc/apdqc.install).

Additional

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT ff.* FROM {filter_format} ff WHERE (status = :db_condition_placeholder_0) ORDER BY weight ASC; Array ( [:db_condition_placeholder_0] => 1 ) in filter_formats() (line 426 of /home/SITENAME/public_html/modules/filter/filter.module).

Uncaught exception thrown in shutdown function.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: DELETE FROM {semaphore} WHERE (value = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => 108452523856144303f35b00.70859337 ) in base_lock\lock_release_all() (line 372 of /home/SITENAME/public_html/sites/all/modules/apdqc/apdqc.lock.db.inc).

Uncaught exception thrown in session handler.

PDOException: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away: SELECT 1 AS expression FROM {sessions} sessions WHERE ( (sid = :db_condition_placeholder_0) AND (ssid = :db_condition_placeholder_1) ); Array ( [:db_condition_placeholder_0] => pcpDwpgSvzb_s5oAmn2dc-WLPEhagzaSoYGc8spt_Ww [:db_condition_placeholder_1] => ) in _drupal_session_write() (line 351 of /home/SITENAME/public_html/sites/all/modules/apdqc/apdqc.session.inc).
mikeytown2’s picture

@Sylense
Using something like phpmyadmin does mysql crash when running SHOW VARIABLES LIKE 'socket' using the user/pass that drupal uses?

Also it looks like the log is only showing the startup, not why is stopped running. I'd check /var/log/syslog, /var/log/mysql.log, and /var/log/mysql.err for any indications as to what might be causing the issue

Sylense’s picture

I've ran the SHOW VARIABLES query without any problems and I don't see any additional info in the logs. I'm still digging but that's all the information I have right now.

mikeytown2’s picture

Does SELECT VERSION(); work? That's the previous query

Sylense’s picture

Yes, it returns 5.6.23-log

Sylense’s picture

Ok, so this is by no means a solution but merely troubleshooting. I commented out the following section in apdqc.install starting at line 148 (latest dev oct 6 2015)

// Check if mysqlnd is installed.
    if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
      $mysqlnd = array();
      exec('php -m | grep mysqlnd', $mysqlnd);
      if (!in_array('mysqlnd', $mysqlnd)) {
        $release_info = array();
        // Get server version.
        exec('ls /etc/*release', $release_info);
        $release_info_string = implode(',', $release_info);
        $directions = '';
        if (strpos($release_info_string, 'lsb-release') !== FALSE) {
          // PHP 5.4 on ubuntu has php5enmod available.
          if (PHP_VERSION_ID < 50400) {
            $directions = $t('Run sudo apt-get install php5-mysqlnd &amp;&amp; sudo php5enmod mysqlnd&lt;code&gt;&#039;);&#10;          }&#10;          else {&#10;            $directions = $t(&#039;Run &lt;code&gt;sudo apt-get install php5-mysqlnd. You might need to add the extension to your php.ini file as well extension=mysqlnd.so; should be located here: @ini', array('@ini' => php_ini_loaded_file()));
          }
        }
        elseif (strpos($release_info_string, 'redhat-release') !== FALSE) {
          $directions = $t('Run sudo yum remove php-mysql &amp;&amp; sudo yum install php-mysqlnd. You might need to add the extension to your php.ini file as well extension=mysqlnd.so; should be located here: @ini', array('@ini' => php_ini_loaded_file()));
        }
        if (!empty($directions)) {
          $requirements['apdqc_mysqlnd'] = array(
            'title' => $t('APDQC'),
            'value' => $phase === 'install' ? FALSE : $t('The mysqlnd extension is not installed on this server.'),
            'severity' => REQUIREMENT_ERROR,
            'description' => $directions,
          );
        }
      }
    }

This allowed the status report page to load. I applied all the suggestions to settings.php and php.ini. However, I get the following messages and am unable to resolve them:

APDQC	mysqli_reap_async_query
mysqli_reap_async_query() is disabled on this server. Please contact your hosting provider and see if they can re-enable this function for you.
APDQC	MYSQLI_ASYNC
MYSQLI_ASYNC is not available on this server. Please contact your hosting provider and see if they can make it available for you.

I've checked to be sure mysqli and mysqlnd are enabled by using the command php -m. I'm wondering if this is tied to why the chunk of code I commented out was crashing MySQL. After all that chunk of code is what is checking for mysqlnd.

mikeytown2’s picture

It checks by running these 2 commands in the shell

php -m | grep mysqlnd
ls /etc/*release

If this does crash MySQL then that's pretty odd in my book. Does running these on your server cause issues?

Sylense’s picture

Those commands work fine in shell but it looks like the issue might be exec() used in PHP.

EDIT:
It's only the following exec() command that is crashing
exec('php -m | grep mysqlnd', $mysqlnd);

When I comment that out everything else works fine except for it obviously will print the message saying I need to install mysqlnd. Mysqlnd is enabled so I can ignore the message but I'm wondering if there is an alternate way of checking for mysqlnd that doesn't crash.

mikeytown2’s picture

Does this crash for you?

exec('php -m', $mysqlnd);

Sylense’s picture

Yes, I've tried that as well figuring maybe grep was causing it to hang but it still crashes.

mikeytown2’s picture

Odd that showing complied modules crashes MySQL
http://php.net/manual/en/features.commandline.options.php

I'm guessing this is a bug with PHP or MySQL. Have you thought about re-installing mysqlng?

Sylense’s picture

Ahh, I think I fixed the issue. I changed the command to use the long option and am no longer getting any errors or crashes. Not sure why that makes a difference but re-compiling apache/php didn't even work. It didn't work until I made the change below.

Changing
exec('php -m | grep mysqlnd', $mysqlnd);

To
exec('php --modules | grep mysqlnd', $mysqlnd);

Sylense’s picture

Here's a patch for the change above. Not sure if this fixes the issue for the OP or for anyone else that may have issues.

mikeytown2’s picture

Status: Active » Fixed

Thanks for debugging this! #17 has been committed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.