Send::Email doesn't finish SMTP transaction properly

Bug #228679 reported by Tomasz Chomiuk
4
Affects Status Importance Assigned to Milestone
libemail-send-perl (Debian)
Fix Released
Unknown
libemail-send-perl (Ubuntu)
Fix Released
Medium
Unassigned

Bug Description

Binary package hint: libemail-send-perl

hi, it looks like Send::Email forgets sending QUIT command after sending emails... in result there's many timeout connection log entries in mail.info

May 9 12:37:11 hostname postfix/smtpd[9395]: timeout after END-OF-MESSAGE from hostname[127.0.1.1]
May 9 12:37:11 hostname postfix/smtpd[9395]: disconnect from hostname[127.0.1.1]

thanks

Tags: email perl smtp
Revision history for this message
petski (petski) wrote :
Revision history for this message
petski (petski) wrote :

I suspect you're using "mailer => SMTP".

I just looked at the source code for Email::Send::SMTP, and noticed that "QUIT" is only called in two scenario's:

1) The Email::Send object get's out of scope
2) send() is called for the second time (which seems weird).

A workaround could be:

1) Make sure your Email::Send object get's out of scope sooner (using "if(1)" or "curly brackets"), like this:

=begin of code example=

# some code here
if(1) {
 my $sender = Email::Send->new({mailer => 'SMTP'});
 $sender->mailer_args([Host => 'smtp.example.com']);
 $sender->send($message);
}
# rest of code

=end of code example=

2) Use "mailer => Sendmail" instead

Revision history for this message
Tomasz Chomiuk (t-chomiuk) wrote : Re: [Bug 228679] Re: Send::Email doesn't finish SMTP transaction properly

thanks mate.. actually I've been using 'mailer => sendmail' for a
quite some time now since it makes more sense due to tsl/sasl setup.
think i should try e::sender some time soon.. please do keep up the
excellent work!

2008/12/30 petski <email address hidden>:
> I suspect you're using "mailer => SMTP".
>
> I just looked at the source code for Email::Send::SMTP, and noticed that
> "QUIT" is only called in two scenario's:
>
> 1) The Email::Send object get's out of scope
> 2) send() is called for the second time (which seems weird).
>
> A workaround could be:
>
> 1) Make sure your Email::Send object get's out of scope sooner (using
> "if(1)" or "curly brackets"), like this:
>
> =begin of code example=
>
> # some code here
> if(1) {
> my $sender = Email::Send->new({mailer => 'SMTP'});
> $sender->mailer_args([Host => 'smtp.example.com']);
> $sender->send($message);
> }
> # rest of code
>
> =end of code example=
>
> 2) Use "mailer => Sendmail" instead
>
> --
> Send::Email doesn't finish SMTP transaction properly
> https://bugs.launchpad.net/bugs/228679
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
petski (petski) wrote :

No problem Tomasz.

Just to get things clear, could you please answer these two questions:

1) At the time you created this bug, you were using "mailer => SMTP"? If not, what did you use?

2) The script you used at that time had it's layout like this:

=begin of example=

# some code here
my $sender = Email::Send->new({mailer => 'SMTP'});
$sender->mailer_args([Host=> 'smtp.example.com']);
$sender->send($message);
# some other code that could take more than a couple of seconds
# etc etc

=end of example=

Revision history for this message
Tomasz Chomiuk (t-chomiuk) wrote :

question 1 - yes.

question 2 - normally the remaining code doesn't take that long to
finish, but now when u mentioned it I remember I had problems where a
child process (where the script is being run from) wouldn't exit
properly continuing to execute parent code. in that case the answer is
yes... however I use Email::Send throughout my app many times and not
all of the calls have got the same run scenario thus I don't know if
that one was the only one which caused the problems.

2008/12/31 petski <email address hidden>:
> No problem Tomasz.
>
> Just to get things clear, could you please answer these two questions:
>
> 1) At the time you created this bug, you were using "mailer => SMTP"? If
> not, what did you use?
>
> 2) The script you used at that time had it's layout like this:
>
> =begin of example=
>
> # some code here
> my $sender = Email::Send->new({mailer => 'SMTP'});
> $sender->mailer_args([Host=> 'smtp.example.com']);
> $sender->send($message);
> # some other code that could take more than a couple of seconds
> # etc etc
>
> =end of example=
>
> --
> Send::Email doesn't finish SMTP transaction properly
> https://bugs.launchpad.net/bugs/228679
> You received this bug notification because you are a direct subscriber
> of the bug.
>

Revision history for this message
petski (petski) wrote :
petski (petski)
Changed in libemail-send-perl:
status: New → Confirmed
petski (petski)
Changed in libemail-send-perl:
assignee: nobody → petski
status: Confirmed → In Progress
Revision history for this message
petski (petski) wrote :

Upstream has fixed this bug in a new release (version 2.194). Debdiff is attached.

I've also build the package for Intrepid in my PPA: https://launchpad.net/~petski/+archive

Revision history for this message
Steve Stalcup (vorian) wrote :

Great work so far!

Can you also take care of these:

W: libemail-send-perl source: out-of-date-standards-version 3.7.3 (current is 3.8.0)
W: libemail-send-perl source: versioned-dependency-satisfied-by-perl build-depends-indep: libmodule-pluggable-perl (>= 2.97)
E: libemail-send-perl source: build-depends-on-obsolete-package build-depends-indep: libmime-perl
Finished running lintian.

I'm unsubscribing u-u-s, please resubscribe universe sponsors when complete

Thanks!

Changed in libemail-send-perl:
importance: Undecided → Medium
status: In Progress → Incomplete
Revision history for this message
petski (petski) wrote :

That's weird. When I ran lintian, the only output I got was the out-of-date-standards-version-3.7.3 warning. Are you sure it wasn't a patch problem?

I've used Launchpad's PPA to build an intrepid and a jaunty version for libemail-send-perl. I bumped to Standards-Version 3.8.0. Lintian is "clean" now.

pet@workmate:~/work$ lintian -i libemail-send-perl_2.194-0ubuntu1~ppa2+intrepid.dsc
pet@workmate:~/work$ lintian -i libemail-send-perl_2.194-0ubuntu1~ppa2+jaunty.dsc

Buildlogs can be found at https://launchpad.net/~petski/+archive

Debdiff for jaunty is attached.

Revision history for this message
Steve Stalcup (vorian) wrote :

uploaded.

Thanks for your contribution to Ubuntu. Please forward this change to Debian.

Changed in libemail-send-perl:
assignee: petski → nobody
status: Incomplete → Fix Committed
petski (petski)
Changed in libemail-send-perl:
importance: Undecided → Unknown
status: New → Unknown
petski (petski)
Changed in libemail-send-perl:
status: Fix Committed → Fix Released
Changed in libemail-send-perl (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.