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

Re: why not support refresh config file?

??? wrote:

When I change loglevel in slapd.conf,I exec "kill -HUP slapd's pid",then slapd exit.

That is what the HUP signal is used for in slapd. It can optionally be configured to wait for active connections to complete before terminating. By the way, in general, it is a bad idea to send a signal to a process if you haven't read the documentation that tells you what signals are supported and what their effects are.

Did openldap support refresh config file?

Apparently not. Although you can certainly gain this effect if you use a parent manager process that automatically respawns slapd if it exits due to a SIGHUP.

I watch the code and found that openldap don't support it.
I think it is easy to support it:
when slapd receive HUP sig,it call function "read_config" to reread config,am I right?

That is the function that loads the configuration at startup time, yes, but it is far more complicated to refresh than just rereading the config file. If any configuration items have been removed since the last time the config file was read, all the associated data structures must be located and safely deleted from memory. This is nearly impossible in many cases. If we simply destroy all data structures and recreate them all, that is still a lot of work and it is easier just to terminate the process and start a new one. If you do not wish to terminate the process, because there are active connections, it's an even worse problem because those connections may be actively using the config data that you are destroying and recreating. So in short, refreshing the entire config file without just restarting the server is a really bad idea, and next to impossible to do correctly.

Eventually OpenLDAP 2.3 will be available with full LDAP access to the slapd configuration, in which case you can just issue an LDAPmodify request to change little things like loglevel and such. That will eliminate any need for a "refresh" feature.

 -- Howard Chu
 Chief Architect, Symas Corp.       Director, Highland Sun
 http://www.symas.com               http://highlandsun.com/hyc
 Symas: Premier OpenSource Development and Support