Debugging getmail delivery errors

Christopher Baines mail at
Tue Jun 18 00:44:24 AEST 2019

Stephen Finucane <stephen at> writes:

> On Sun, 2019-06-16 at 18:13 +0100, Christopher Baines wrote:
>> Christopher Baines <mail at> writes:
>> > Christopher Baines <mail at> writes:
>> >
>> > > The Patchwork instance [1] I've been playing with has been working quite
>> > > nicely, but recently getmail doesn't want to stay up, as I think it's
>> > > having problems delivering a specific email (this is from the getmail
>> > > logs):
>> > >
>> > >   Delivery error (command patchwork-admin 25561 error (1, ))
>> > >     msg 517/525 (5397 bytes), delivery error (command patchwork-admin 25561 error (1, ))
>> > >
>> > > Any tips on debugging this? I haven't even worked out what message it
>> > > might be yet, and I'm not sure if the parsemail command does any
>> > > logging?
>> >
>> > To answer my own question, eventually I worked out that Getmail logs
>> > more detailed information to the syslog, including the message id.
>> >
>> > Comparing this to the Maildir on the mailserver, I was able to identify
>> > the email causing the issue.
>> >
>> > I then manually ran the patchwork-admin parsemail command. Initially it
>> > gave no output, but running it with DEBUG=True in the Django settings
>> > did output the error to the console. I think when DEBUG=False, the error
>> > is sent by email (with the default logging configuration).
>> >
>> > I've now got a stacktrace at least, and it seems the error relates to a
>> > database constraint...
> Thanks for looking into this and not getting to it sooner myself. If
> you have any additional notes on how you debugged this issue and
> wouldn't mind dumping them into an email or Etherpad somewhere, I'd be
> happy to whip up an official debugging document. That would make for
> two good things to come out of this unfortunate affair (the other being
> your hopefully now-working deployment).

No problem :) I think my main realisation from is that because I haven't
configured my Patchwork instance with any ADMINS email addresses, I won't
get notifications of errors.

Maybe I should provide an ADMINS email address, however, just logging
the errors to to a file would be my personal preference. I should
probably tweak the default logging configuration to log to some files.

It might be easier to guide others through debugging this kind of issue
if the default logging configuration logged errors from the parsemail
command to a file.

>> Ah, and it looks like there is an unreleased change that'll resolve this
>> issue [1] :)
> I'll look into backporting this an including it in a future v2.1.4
> patch. Not sure why I didn't do it the first day, to be honest.

That would be great. I've applied that patch on top of 2.1.3, and it
seems to work well to me.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 962 bytes
Desc: not available
URL: <>

More information about the Patchwork mailing list