Mail::Box POP3 locking issues (2.057 and previous)

Jason Woodward <[email protected]> Mon, 20 Sep 2004 21:16:23 -0400
Newsgroups gmane.comp.lang.perl.modules.mail-box
Message-ID <[email protected]>
This pop3 locking issue is still ongoing.  I have isolated it a bit closer I think.

Using the test script attached, when i run on a mailbox with approx 50 messages, i get:

opening initial connection
message count: 52
closing all folders
opening pop3 again
ERROR: Could not authenticate using 'LOGIN' method
ERROR: Cannot create POP3 client for /var/mail/root.
WARNING: Folder does not exist, failed opening pop3 folder /var/mail/root.
Failed to open pop3: Bad file descriptor at ./test_mail_box.pl line 10.

mail logs show:

Sep 20 18:16:29 mailhost in.qpopper[30790]: (v4.0.5) POP login by user "testuser" at (testhost)
test_host_ip [pop_log.c:244]
Sep 20 18:16:30 mailhost in.qpopper[30791]: (v4.0.5) POP login by user "testuser" at (testhost)
test_host_ip [pop_log.c:244]
Sep 20 18:16:36 mailhost in.qpopper[30792]: testuser at testhost (test_host_ip): -ERR [IN-USE]
/var/spool/pop/.testuser.pop lock busy!  Is another session active? (11) [pop_dropcopy.c:1546]


when i uncomment the line retrieving the message id within the message list loop, i get the
following output:

opening initial connection
message count: 52
closing all folders
opening pop3 again


mail logs show:

Sep 20 18:17:49 mailhost in.qpopper[30796]: (v4.0.5) POP login by user "testuser" at (testhost)
test_host_ip [pop_log.c:244]
Sep 20 18:17:56 mailhost in.qpopper[30797]: (v4.0.5) POP login by user "testuser" at (testhost)
test_host_ip [pop_log.c:244]
Sep 20 18:17:57 mailhost in.qpopper[30798]: (v4.0.5) POP login by user "testuser" at (testhost)
test_host_ip [pop_log.c:244]


Maybe it has something to do with the lazy loading of the messages and somehow not releasing
the second connection.


take care,
jason

--
Jason Woodward
[email protected]

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
 
mQGiBDrwHPoRBAC3nDJRLKTcFcJWid9PN08ChMI7tuQevomWoVeZpZZ0zzip2w/E
ts55Mx58eRRG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O/dsZrm450pjLs
2V3BkMAAn2/6alBBC9b9F94svdOf0mGY/G5w
=4p8c
-----END PGP PUBLIC KEY BLOCK-----

my($c,@s)=(0,qw( | / - \ ));$|++;my$p;&{sub{map{$p.=chr$_}
unpack(join('a',('',split(//,$_->[1]))),$_->[0]);}}foreach
[qw/74117115116 2333/],[qw/65110111116104101114 2333333/],
[qw/80101114108 2333/],[qw/729799107101114 222333/];{my$z=
$c<4?$s[$c++]:$s [$c=0];printf"\ec%s%s%s",$z,$p,$z,select*
STDOUT,*STDOUT,*STDOUT,0.1,;redo;}##########JAPH##########
test_mail_box.pl (application/octet-stream, 969 B)
#!/usr/bin/perl
$|++;
use strict;
use warnings;
use Mail::Box::Manager;

sub open_pop3 {
  my $manager = shift;

	my $pop3 = $manager->open(
    type => "pop3",
    username => "USER",
    password => "PASS",
    server_name => "HOST",
    server_port => "110",
		authenticate => "LOGIN",
  ) or die "Failed to open pop3: $!";
	return $pop3;
}

my $manager = Mail::Box::Manager->new();
die "Failed to instantiate manager" unless $manager;

print "opening initial connection\n";
my $pop3 = open_pop3($manager);
die "Failed to open pop3 connection" unless $pop3;

# do some work...
my $count = scalar($pop3->messages());
print "message count: $count\n";
foreach my $msg ($pop3->messages()){
	#my $id = $msg->messageId();
}

# close all open folders, committing all deletes on the pop3 server, etc
print "closing all folders\n";
$manager->closeAllFolders();

sleep 3;

# re-open the connection to do further work
print "opening pop3 again\n";
$pop3 = open_pop3($manager);