Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Can't call method 'notes' on unblessed reference in plugins/logging/file. #272

Merged
merged 1 commit into from Sep 27, 2016

Conversation

salvis
Copy link
Contributor

@salvis salvis commented Sep 27, 2016

I still get a

FATAL PLUGIN ERROR [logging::file_3a7]: Can't call method "notes" on unblessed reference at /home/smtpd/qpsmtpd/plugins/logging/file line 279.

message from the current HEAD. This patch fixes it.

@coveralls
Copy link

coveralls commented Sep 27, 2016

Coverage Status

Coverage remained the same at 48.84% when pulling bdc536e on salvis:master into e551786 on smtpd:master.

@msimerson msimerson merged commit 494dc95 into smtpd:master Sep 27, 2016
@salvis
Copy link
Contributor Author

salvis commented Sep 29, 2016

Thank you for committing this and making HEAD work for me. I continue to wonder why this seemingly happens only to me. Is it because I'm the only one running qpsmtpd from xinetd according to https://wiki.qpsmtpd.org/doku.php?id=deploy:start ?

If I enable logging/file with loglevel DEBUG, then hook_logging() is called 300+ times, and out of these 15 calls come in with a $transaction object that cannot do 'notes'. Why does this happen? And why only on my servers?

A side-effect of the fix above is that log_output() is called 15 times to re-evaluate the _log_format, and since I cannot use %i (see below) I have a timestamp with seconds in the _log_format. The seconds typically change during a transaction and each transaction is split into 3 or 4 DEBUG log files. (Transactions sometimes get interleaved, too.)

Since...

sub log_output {
my ($self, $transaction) = @_;
my $output = $self->{_log_format};
$output =~ s/%i/($transaction->notes('logging-session-id') || 'parent')/ge;
$output = strftime $output, localtime;
$output;
}

... also calls $transaction->notes(), if "%i" is in the _log_format, I cannot use "%i" or I get 15
FATAL PLUGIN ERROR [logging::file_3a7]: Can't call method "notes" on unblessed reference...
messages again. These are not actually fatal though, but "%i" gets replaced with "parent", which is useless.

With xinetd, the logging-session-id seems to be $$ (the pid). Is it different in other configurations? If there was a way to tell in which configuration we're running, I could use the $$, save the file name and enforce "nosplit" in the xinetd case.

What do you think?

@msimerson
Copy link
Member

No idea, I no longer have any QP deployments.

@salvis
Copy link
Contributor Author

salvis commented Sep 29, 2016

Ouch, sorry to hear that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants