[Date Prev][Date Next] [Chronological] [Thread] [Top]

openldap back-sql mysql wait_timeout



Dear members,

I have timeout issues with back-sql using mysql as backend (read-only).




I could successfully setup open-ldap with back-sql querying from a mysql db.
However there is a wait_timeout in mysql and if no query is being made for > then wait_timeout the slapd breaks and I have to restart it to connect to mysql again.
http://dev.mysql.com/doc/refman/5.7/en/server-system-variables.html

As a workaround I could implement a cron-job to execute a query every x hour (depending on wait_timeout). However I would much more like that back-sql is able to (auto-)reconnect.
I'm not a developer and have no idea how this can be done - maybe this is in the sql-wrap.c code?

executing an ldap query after "wait_timeout" returns slapd.log:
Jul 20 17:22:53 STAG-BCC slapd[2054]: ==>backsql_get_db_conn()
Jul 20 17:22:53 STAG-BCC slapd[2054]: <==backsql_get_db_conn()
Jul 20 17:22:53 STAG-BCC slapd[2054]: ==>backsql_attrlist_add(): adding "objectClass" to list
Jul 20 17:22:53 STAG-BCC slapd[2054]: ==>backsql_dn2id("dc=bbn,dc=ch") matched expected
Jul 20 17:22:53 STAG-BCC slapd[2054]:    backsql_dn2id("dc=bbn,dc=ch"): id_query "SELECT id,keyval,oc_map_id,dn FROM ldap_entries WHERE dn=?"
Jul 20 17:22:53 STAG-BCC slapd[2054]:    backsql_dn2id("dc=bbn,dc=ch"): error executing query ("SELECT id,keyval,oc_map_id,dn FROM ldap_entries WHERE dn=?", "dc=bbn,dc=ch"):
Jul 20 17:22:53 STAG-BCC slapd[2054]: Return code: -1
Jul 20 17:22:53 STAG-BCC slapd[2054]:    nativeErrCode=2006 SQLengineState=08S01 msg="[MySQL][ODBC 5.1 Driver][mysqld-5.5.49-0+deb8u1]MySQL server has gone away"
Jul 20 17:22:53 STAG-BCC slapd[2054]: <==backsql_dn2id("dc=bbn,dc=ch"): err=80


Any suggestions are most welcome

Br
Simon

I'm using the following setup:
-----------------------------
Debian Jessie x86_64 (up to date)
Openldap-2.4.44 compiled from source with ./configure --enable-sql
libmyodbc 5.1.10-3
mysql 5.5.49-9

odbc.ini:
[ldapds]
Driver = MySQL
Description = BCC MySQL DB
SERVER = 127.0.0.1
PORT = 3306
USER = ldap
Password = ldap
Database = prov_ldap
SOCKET = /var/lib/mysql/mysql.sock

odbcinst.ini:
[MySQL]
Description = ODBC for MySQL
Driver = /usr/lib/x86_64-linux-gnu/odbc/libmyodbc.so
Setup = /usr/lib/x86_64-linux-gnu/odbc/libodbcmyS.so
FileUsage = 1

slapd.conf:
include         /usr/local/etc/openldap/schema/core.schema
include         /usr/local/etc/openldap/schema/cosine.schema
include         /usr/local/etc/openldap/schema/inetorgperson.schema
include         /usr/local/etc/openldap/schema/SIP.schema
pidfile         /usr/local/var/run/slapd.pid
argsfile        /usr/local/var/run/slapd.args
loglevel any
database        sql
suffix          "dc=bbn,dc=ch"
rootdn          "dc=bbn,dc=ch"
rootpw          ldap
dbname          ldapds
dbuser          ldap
dbpasswd        ldap
subtree_cond    "ldap_entries.dn LIKE CONCAT('%',?)"
insentry_stmt   "INSERT INTO ldap_entries (dn,oc_map_id,parent,keyval) VALUES (?,?,?,?)"
has_ldapinfo_dn_ru      no
#cachesize      0