So I have a Trac install and wanted to be able to open tickets with an email. No problem. Some nice person has written a python script to do so. I download it and go about installing it and configuring it on CentOS 4. After configuring it I need to setup an MTA to feed it. I choose Postfix 2.2.10 since it was already on the machine. To setup Postfix with the script you just put a line in your aliases file that pipes the incoming email to the trac2email script.
Since the Trac files and db's are owned by the web server user apache I need the Trac script to be run as the apache user. Postfix makes this really simple. It's best described by the group that makes the script.
You can run a delivery command as any user just by placing the aliases in a separate file and chowning that aliases file to the user you want the delivery to run as. Then you run postalias /path/to/aliases, which will create /path/to/aliases.db, and you then just add hash:/path/to/aliases to the alias_maps config variable in main.cf. The only caveat is that the user who owns the separate aliases file needs to have write perms to the directory that it's stored in.
So I make an aliase file and put in the following line.
tickets: "|/usr/bin/email2trac [--project=
Then chown it to the apache user:group and run my postalias command on it. I put the hash line in the alias_maps config and restarted postfix. That's when the problem started. When sending an email to the alias I was getting the error "db.commit() pysqlite2.dbapi2.OperationalError: database or disk is full".
I check if the disk is full and it is not even near full. I know the SQLite db does not have a set limit so I'm totally perplexed by this error message. I decide to run an strace on the script and see what it's actually doing. To do this you can just put "strace -o /tmp/trace" right after the | in the pipe command. I send another email and look at the trace file. I find the interesting error when the script tries to write to the SQLite db. The error is "write(3, ...)= -1 EFBIG (File too large) --- SIGXFSZ (File size limit exceeded)". (3,...) is the sqlite.db file in the trace.
File to large tells me there is a limit somewhere and I need to find out how to bump it up. Making a new Trac site and running the same script the email goes through fine. Other existing Trac sites on the same server work fine with the emal2trac script also. It's now down to just this one site that does not work.
Finally I start zeroing in on the SQLite db size. Most of the other sites have smaller db's which are like 10 to 40 megs. The Trac site with the problem has a 60meg db. Now why can the script write to a 40meg db but not a 60meg db?
I crack open the Postfix mail.cf file and start looking at different size limits in there for different things. I know I"m looking for something possibly in the over 40meg range. The one that sticks out is the mailbox_size_limit setting. It's set to its default of 51200000 bytes. That's 52meg. I change it to 0 which is unlimited and save and exit. Restart Postfix. Send another test email and BAM! Mail goes right through.
Somehow in Postfix mailbox_size_limit is not just the mailbox size limit. It also seems to be connected to any file the pipe process opens. If a file is opened bigger than the limit set it will not be able to write to the opened file. This process limit by Postfix makes it look to SQLite like the disk is full. I only tested this with 2.2.10 of postfix. It might be different later versions.