Procmail + rt_mailgate error-prone behaviour

Hello, everyone!

From time to time the following message shows up in our procmail.log:
An Error Occurred

500 Server closed connection without sending any
data back

We use rt-3.6.4 codebase with mod_perl2-2.0.3_1 embedded into Apache/2.2.4 (FreeBSD, apache-2.2.4_2, prefork MPM), cleanly customized with ‘local’ subdirs (so as to unpack attachments and calculate their MD5 sums, for instance. etc). Database backend is pgsql.

I am sure it’s web server to blame (it’s set up to have the fixed amount of workers all the time, each of them processing up to 256 requests. We have to put some limits on apache to prevent processing of mail bombs and to prevent webserver+pgsql exhausting 4Gb of RAM).

Of course, our users get no feedback at all when rt-mailgate fails.

What would be the best practice for fixing it?
Am I right we should make rt-mailgate to back up incoming mails into local filesystem, and to clean messages processed successfully with ‘TRAP’ procmail handler? (Thus we could only keep ‘faulty’ messages all in one place, with the ability to recover/purge them later).

How could we try to reproduce this problem?

I will gladly appreciate any feedback.

Best regards,