1

Topic: Error messages after recent upgrade to mysql 5.7.23

======== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release):  0.9.8
- Linux/BSD distribution name and version:  FreeBSD 11.2
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.


Hello All,

After the recent update of the mysql I am getting the following errors in the maillog:

Aug 31 00:22:57 mail amavis[73192]: (73192-05) NOTICE: reconnecting in response to: err=2006, HY000, DBD::mysql::st execute failed: MySQL server has gone away at (eval 107) line 173.
Aug 31 01:01:14 mail postfix/proxymap[12740]: warning: connect to mysql server 192.168.1.101:3306: Can't connect to MySQL server on '192.168.1.101' (61)
Aug 31 01:01:14 mail postfix/trivial-rewrite[12741]: warning: proxy:mysql:/usr/local/etc/postfix/mysql/transport_maps_maillist.cf lookup error for "*"
Aug 31 01:01:14 mail postfix/trivial-rewrite[12741]: warning: proxy:mysql:/usr/local/etc/postfix/mysql/transport_maps_maillist.cf lookup error for "*"
Aug 31 01:01:14 mail postfix/proxymap[12740]: warning: connect to mysql server 192.168.1.101:3306: Can't connect to MySQL server on '192.168.1.101' (61)
Aug 31 01:01:14 mail postfix/cleanup[12731]: warning: proxy:mysql:/usr/local/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "root@mail.eu"
Aug 31 01:01:16 mail postfix/cleanup[12731]: warning: proxy:mysql:/usr/local/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "root@mail.eu"
Aug 31 01:01:16 mail postfix/cleanup[12731]: warning: proxy:mysql:/usr/local/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "netdata@mail.eu"
Aug 31 01:02:02 mail postfix/cleanup[12731]: warning: proxy:mysql:/usr/local/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "root@mail.eu"
Aug 31 01:02:02 mail postfix/cleanup[12731]: warning: proxy:mysql:/usr/local/etc/postfix/mysql/sender_bcc_maps_user.cf lookup error for "netdata@mail.eu"
Aug 31 01:03:02 mail amavis[73178]: (73178-06) NOTICE: reconnecting in response to: err=2006, HY000, DBD::mysql::st execute failed: MySQL server has gone away at (eval 107) line 173.

Also the cleanup_db.py cron script reports the following:

Traceback (most recent call last):
  File "/opt/iredapd/tools/cleanup_db.py", line 34, in <module>
    total_before = sql_count_id(conn_iredapd, 'throttle_tracking')
  File "/opt/iredapd/tools/../tools/__init__.py", line 81, in sql_count_id
    what='count(%s) as total' % column)
  File "/usr/local/lib/python2.7/site-packages/web/db.py", line 719, in select
    return self.query(qout, processed=True)
  File "/usr/local/lib/python2.7/site-packages/web/db.py", line 678, in query
    db_cursor = self._db_cursor()
  File "/usr/local/lib/python2.7/site-packages/web/db.py", line 590, in _db_cursor
    return self.ctx.db.cursor()
  File "/usr/local/lib/python2.7/site-packages/web/db.py", line 531, in _getctx
    self._load_context(self._ctx)
  File "/usr/local/lib/python2.7/site-packages/web/db.py", line 542, in _load_context
    ctx.db = self._connect(self.keywords)
  File "/usr/local/lib/python2.7/site-packages/web/db.py", line 570, in _connect
    return self.db_module.connect(**keywords)
  File "/usr/local/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
_mysql_exceptions.OperationalError: (2026, 'SSL connection error: error:00000005:lib(0):func(0):DH lib')

The mysql server is running without any problem? Why is this happening?

Best regards,

Tomassino

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Error messages after recent upgrade to mysql 5.7.23

detomassino wrote:

Aug 31 01:01:14 mail postfix/proxymap[12740]: warning: connect to mysql server 192.168.1.101:3306: Can't connect to MySQL server on '192.168.1.101' (61)

Is there any permission/privilege issue? Do SQL users on iRedMail server have privilege to access to MySQL server and query?

3

Re: Error messages after recent upgrade to mysql 5.7.23

Dear Zhang,

There shouldn't be any issue like that as it doesn't happen all the time.
Also, all was well until the recent mysql update.

4

Re: Error messages after recent upgrade to mysql 5.7.23

Did you try to connect from command line manually?

5

Re: Error messages after recent upgrade to mysql 5.7.23

Hello Zhang,

I can connect with this command without a problem

root@mail:~ # mysql -u root -p -h 192.168.1.101                 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1963
Server version: 5.7.23-log Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

root@192.168.1.101 [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| amavisd            |
| iredadmin          |
| iredapd            |
| mysql              |
| performance_schema |
| roundcubemail      |
| sys                |
| vmail              |
+--------------------+
9 rows in set (0.00 sec)

6

Re: Error messages after recent upgrade to mysql 5.7.23

Please try to connect with the SQL account defined in /etc/postfix/mysql/*.cf.

7

Re: Error messages after recent upgrade to mysql 5.7.23

No problem with that, it seems

root@mail:/usr/local/etc/postfix/mysql # mysql -u vmail -p -h 192.168.1.101 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3213
Server version: 5.7.23-log Source distribution

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

vmail@192.168.1.101 [(none)]> 

8

Re: Error messages after recent upgrade to mysql 5.7.23

detomassino wrote:

vmail@192.168.1.101 [(none)]>

Can you run some SQL queries?

9

Re: Error messages after recent upgrade to mysql 5.7.23

Yes, I can.

I don't know if it is of any relevance but several of the py scripts in the tools directory fail with the same error as shown above, not only cleanup_db.py.

10

Re: Error messages after recent upgrade to mysql 5.7.23

Do you config ssl for mysql?

Can you run below SQL command, then show me result?

show variables like '%ssl%';

11

Re: Error messages after recent upgrade to mysql 5.7.23

I haven't done any ssl config for mysql .It is the standard installation.

The output of is

+---------------+-----------------+
| Variable_name | Value           |
+---------------+-----------------+
| have_openssl  | YES             |
| have_ssl      | YES             |
| ssl_ca        | ca.pem          |
| ssl_capath    |                 |
| ssl_cert      | server-cert.pem |
| ssl_cipher    |                 |
| ssl_crl       |                 |
| ssl_crlpath   |                 |
| ssl_key       | server-key.pem  |
+---------------+-----------------+

Now I am looking at these, I have custom certificates, don't use the ones which your your installer installed. Can this be the problem?

12

Re: Error messages after recent upgrade to mysql 5.7.23

- I think the problem is Amavisd/iRedAdmin/iRedAPD don't use secure connection to mysql server by default. You can try to change these settings and try again.
- Does remote mysql server force secure connection?

13

Re: Error messages after recent upgrade to mysql 5.7.23

Hello Zhang,

Thanks your help.

It seems mysql on the server side is configured to use mysql by default here??
I have disabled it temporarily to see whether the error persists.

BW.

14

Re: Error messages after recent upgrade to mysql 5.7.23

All components are configured to use LOCAL mysql server by default, so no ssl connection is required.

15 (edited by detomassino 2018-09-24 17:04:16)

Re: Error messages after recent upgrade to mysql 5.7.23

Hello Zhang,
After manually disabling the ssl for connection to mysql server the error is gone. Thank you.

Strangely it came about after the update of the mysql server which then defaulted to connect via ssl without any changes to configuration made.

16

Re: Error messages after recent upgrade to mysql 5.7.23

Maybe some mysql server parameter changed and impacts the connection? Any idea?

17

Re: Error messages after recent upgrade to mysql 5.7.23

Not really. No changes to config were made. I will monitor it after next update.