The following issue has been RESOLVED. 
====================================================================== 
http://www.dbmail.org/mantis/view.php?id=736 
====================================================================== 
Reported By:                niki
Assigned To:                paul
====================================================================== 
Project:                    DBMail
Issue ID:                   736
Category:                   Database layer
Reproducibility:            always
Severity:                   block
Priority:                   normal
Status:                     resolved
target:                      
Resolution:                 fixed
Fixed in Version:           2.3.5
====================================================================== 
Date Submitted:             20-Nov-08 22:08 CET
Last Modified:              21-Nov-08 19:54 CET
====================================================================== 
Summary:                    DBMail consuming db connections, and stops
responding
Description: 
Just updated DBMail to 2.3.4 "official" dbmail experimental

When I connect with Evo, dbmail starts to consume connections up until 32
(have configred it to to max 50) while logging some db errors, after it
has stopped at 32 db connections it, I can still filter a couple of ails
into folders before it dops all connections to the db.

Lmtp is still running fine.
The db is Postgres 8.3.3 (Debian)
====================================================================== 

---------------------------------------------------------------------- 
 niki - 20-Nov-08 22:38  
---------------------------------------------------------------------- 
Her is a log with log level 128 

---------------------------------------------------------------------- 
 netvulture - 20-Nov-08 22:45  
---------------------------------------------------------------------- 
Can you please post the new log using these settings.

FILE_LOGGING_LEVELS = 511
errorlog = /path/to/log/file

Your last log file only said SQLException: a bunch of times. Syslog
probably cut off the messages.

Also, is your database running on the same box, or a different host? If
over the network, describe the connection (10? 100? 1000? mbit LAN, or
other?).
How many connections is your db server set to handle? Try setting it to
150 using max_connections(150) in the db config file. 

---------------------------------------------------------------------- 
 niki - 20-Nov-08 22:56  
---------------------------------------------------------------------- 
The 2nd file I uploaded is a copy of the dbmail error log at loglevel 128
(dbmail-2.err.bz2), but I'll get you a copy of the same file at log leve
511 in a sec, I'll just answer a couple of you questions first.

Postgres is running on a dedicated host, right next to the mail server,
connected via an ethernet switch (all of it is 100M), and the dbmail user
is set to have no connection limit in Postgres. 

---------------------------------------------------------------------- 
 niki - 20-Nov-08 23:20  
---------------------------------------------------------------------- 
Here is the log at loglevel 511, and max connections set to 150.

When Evo connects, dbmail starts to consume connections again, and it
still stops at 32 connections, when it's done I can manually do 5
successful filter actions, when I hit Ctrl+y the 6th time, Evo returns
with an error saying it couldn't complete the action.

http://www.guldbrand.net/dbmail-3.err.bz2 

---------------------------------------------------------------------- 
 paul - 20-Nov-08 23:34  
---------------------------------------------------------------------- 
this smell very much like a libzdb buglet. 
Could you please test the attached patch? 

---------------------------------------------------------------------- 
 niki - 20-Nov-08 23:40  
---------------------------------------------------------------------- 
I will, but I don't have that mutch experience with debian package
building, stay tuned. 

---------------------------------------------------------------------- 
 netvulture - 20-Nov-08 23:43  
---------------------------------------------------------------------- 
I was wanting you to make sure that your database server was setup to
handle 150 connections. max_db_connections in dbmail.conf should be
something like 20 or 25. IDLE clients will use the excess connections. If
you have trouble with log entries saying could get a db connection, try
[5] with a lot of active clients. Then increase this by about 5 at a time
until it goes away. 

---------------------------------------------------------------------- 
 netvulture - 21-Nov-08 00:48  
---------------------------------------------------------------------- 
>From my initial look at it. There are 30 database connections not closed
for this single client connection. 

>From the count of commands issued, log
http://www.dbmail.org/mantis/view.php?id=3 shows 23 UID commands. During a
UID COPY I did see some db_con_clear double ups. 

---------------------------------------------------------------------- 
 niki - 21-Nov-08 11:23  
---------------------------------------------------------------------- 
Hi folks, sorry for the late post.

I tried the patched version last night, but there wasn't any change int
the behaviour, still uses up 32 connections, and then drops it's
connections when i have filtered 5 to 6 mails. 

---------------------------------------------------------------------- 
 paul - 21-Nov-08 16:55  
---------------------------------------------------------------------- 
I managed to reproduce and fix this, afaict. 
There were some sql syntax problems with postgres that have now been fixed
in my tree. 

---------------------------------------------------------------------- 
 niki - 21-Nov-08 19:12  
---------------------------------------------------------------------- 
I tried to run the code you commited, and it made lmtp start bouncing
mail.

what I did was git clone your repo, and the ran debuild.


I got a lot of these in my log from imapd:

Nov 21 18:52:32 server dbmail/imap4d[7354]: [0x8242ab8] Error:[db]
db_findmailbox_owner(+2096): SQLException: 
Nov 21 18:52:32 server dbmail/imap4d[7354]: [0x8242ab8] Error:[db]
db_createmailbox(+2662): SQLException: 
Nov 21 18:52:55 server dbmail/imap4d[7354]: [0x82429f8] Error:[db]
db_findmailbox_owner(+2096): SQLException: 
Nov 21 18:52:56 server dbmail/imap4d[7354]: [0x8242938] Error:[db]
db_findmailbox_owner(+2096): SQLException: 
Nov 21 18:52:56 server dbmail/imap4d[7354]: [0x8242938] Error:[db]
db_createmailbox(+2662): SQLException: 
Nov 21 18:53:13 server dbmail/imap4d[7354]: [0x8242db8] Error:[db]
db_query(+345): SQLException: ERROR:  column "seq" does not exist LINE 1:
SELECT name,seq FROM dbmail_mailboxes WHERE mailbox_idnr=174  
Nov 21 18:53:13 server dbmail/imap4d[7354]: [0x8242c38] Error:[db]
db_findmailbox_owner(+2096): SQLException: 
Nov 21 18:53:13 server dbmail/imap4d[7354]: [0x8242b78] Error:[db]
db_findmailbox_owner(+2096): SQLException: 
Nov 21 18:53:13 server dbmail/imap4d[7354]: [0x8242b78] Error:[db]
db_createmailbox(+2662): SQLException: 
Nov 21 18:53:13 server dbmail/imap4d[7354]: [0x8242ab8] Error:[db]
db_findmailbox_owner(+2096): SQLException: 
Nov 21 18:53:13 server dbmail/imap4d[7354]: [0x8242ab8] Error:[db]
db_createmailbox(+2662): SQLException: 
Nov 21 18:53:13 server dbmail/imap4d[7354]: [0x82429f8] Error:[db]
db_findmailbox_owner(+2096): SQLException: 


And lmtp logged some of these:

Nov 21 18:53:31 server dbmail/lmtpd[7357]: [0x9005978] Error:[db]
db_exec(+317): SQLException: ERROR:  column "seq" does not exist LINE 1:
UPDATE  dbmail_mailboxes SET seq=seq+1 WHERE mailbox_idnr=5   
Nov 21 18:53:31 server dbmail/lmtpd[7357]: [0x9005978] Error:[message]
blob_exists(+159): SQLException: 
Nov 21 18:53:31 server dbmail/lmtpd[7357]: [0x9005978] Error:[message]
blob_insert(+186): SQLException: 
Nov 21 18:53:31 server dbmail/lmtpd[7357]: [0x9005978] Error:[message]
blob_exists(+159): SQLException: 
Nov 21 18:53:31 server dbmail/lmtpd[7357]: [0x9005978] Error:[message]
blob_insert(+186): SQLException: 
Nov 21 18:53:31 server dbmail/lmtpd[7357]: [0x9005978] Error:[db]
db_query(+345): SQLException: ERROR:  column "seq" does not exist LINE 1:
SELECT name,seq FROM dbmail_mailboxes WHERE mailbox_idnr=1    
Nov 21 18:53:31 server dbmail/lmtpd[7357]: [0x9005978] Error:[message]
insert_messages(+2532): permanent failure sort_and_deliver for useridnr
[4]


Don't know if i have done something wrong, or something, but I was running
this commit with some imaptest wip stuff in it:
5d80e46712701283f91d267414560ac6cc83ddf0 

---------------------------------------------------------------------- 
 paul - 21-Nov-08 19:53  
---------------------------------------------------------------------- 
You need to apply sql/postgresql/2_3_4-2_3_5.pgsql.

If you want to be able to switch between 2.3.2 and 2.3.4+ simply add
the seq column without dropping the mtime column on dbmail_mailboxes.

 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
20-Nov-08 22:08 niki           New Issue                                    
20-Nov-08 22:08 niki           File Added: dbmail-1.log                     
20-Nov-08 22:38 niki           Note Added: 0002636                          
20-Nov-08 22:38 niki           File Added: dbmail-2.err.bz2                    
20-Nov-08 22:45 netvulture     Note Added: 0002637                          
20-Nov-08 22:45 netvulture     Assigned To               => netvulture      
20-Nov-08 22:45 netvulture     Status                   new => acknowledged 
20-Nov-08 22:56 niki           Note Added: 0002638                          
20-Nov-08 23:20 niki           Note Added: 0002639                          
20-Nov-08 23:34 paul           Note Added: 0002640                          
20-Nov-08 23:35 paul           File Added:
0001-workaround-connection-leakage.patch                    
20-Nov-08 23:40 niki           Note Added: 0002641                          
20-Nov-08 23:43 netvulture     Note Added: 0002642                          
21-Nov-08 00:48 netvulture     Note Added: 0002643                          
21-Nov-08 11:23 niki           Note Added: 0002644                          
21-Nov-08 16:55 paul           Note Added: 0002645                          
21-Nov-08 16:55 paul           Status                   acknowledged => assigned
21-Nov-08 16:55 paul           Assigned To              netvulture => paul  
21-Nov-08 16:56 paul           Status                   assigned => resolved
21-Nov-08 16:56 paul           Resolution               open => fixed       
21-Nov-08 16:56 paul           Fixed in Version          => 2.3.5           
21-Nov-08 19:12 niki           Status                   resolved => feedback
21-Nov-08 19:12 niki           Resolution               fixed => reopened   
21-Nov-08 19:12 niki           Note Added: 0002646                          
21-Nov-08 19:53 paul           Note Added: 0002647                          
21-Nov-08 19:53 paul           Resolution               reopened => fixed   
21-Nov-08 19:54 paul           Status                   feedback => resolved
======================================================================

_______________________________________________
Dbmail-dev mailing list
Dbmail-dev@dbmail.org
http://twister.fastxs.net/mailman/listinfo/dbmail-dev

Reply via email to