Robert Spier wrote:
There's nothing special about init(), except it happens first.

Nonetheless, if I switch from register() to init(), the behavior changes (at least under forkserver), and I have an inkling why. With register, I see the following on startup:

1646 Loaded logging/adaptive accept LOGERROR reject LOGDEBUG prefix `
1646 trying to get config for memory_threshold
1646 Loaded logging/adaptive accept LOGERROR reject LOGDEBUG prefix `
1646 trying to get config for plugins
1646 loading plugins from ./plugins
1646 Loading check_earlytalker
1646 check_earlytalker hooking connect
...

and with init(), I see this:

Subroutine plugin_name redefined at (eval 24) line 8.
Subroutine hook_name redefined at (eval 24) line 9.
Subroutine init redefined at ./plugins/logging/adaptive line 5.
Subroutine hook_logging redefined at ./plugins/logging/adaptive line 38.
Subroutine hook_deny redefined at ./plugins/logging/adaptive line 65.
Subroutine hook_reset_transaction redefined at ./plugins/logging/adaptive line 
70.
1653 Loaded logging/adaptive accept LOGERROR reject LOGDEBUG prefix `
1653 trying to get config for memory_threshold
1653 Loaded logging/adaptive accept LOGERROR reject LOGDEBUG prefix `
1653 trying to get config for plugins
1653 loading plugins from ./plugins
1653 Loading check_earlytalker
1653 check_earlytalker hooking connect
...

I'm thinking that is has something to do with the fact that the logging plugin gets loaded in two different contexts (once to get the memory_threshold and once as the shared transaction object). I have been unable to figure out why this is, because if I run the code under a debugger, it doesn't happen.

And indeed, if I comment out this call (from Qpsmtpd::Transaction::start):

  my $sz = $self->config('memory_threshold');

and just go with the default value, I don't get the redefined warnings or the double loading of the logging plugin. I'm going to see about moving the memory_threshold call to later in the load sequence and see how that goes.

John

Reply via email to