how can i debug a "pipe" postfix filter?

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

how can i debug a "pipe" postfix filter?

Jordi Moles

I've got this home-made script, written in C, on a  Freebsd 7.0 server
with different versions of postfix: 2.3,2,4 and 2.5

The problem is that, while most of the time it works like a charm,
sometimes it crashes and bounces the message. It's not really a big
deal, cause the sender gets notified that their mail wasn't delivered
and hopefully, they will resend it. However, the problem is that I've
tried to debug my script but found nothing wrong at all, cause it only
fails from time to time, let's say... once for each 2000 messages that
postfix receives, and it appears to do so in a random way.

As i said... postfix can fail to deliver a message to one particular
mailbox, but if then you resend the very same message to the very same
mailbox, it will be delivered.

The error is reported in both "maillog" and "messages", like this:

Aug  7 01:55:19 mail01 postfix/pipe[27534]: 3E1A0143709:
to=<EMAIL_ACCOUNT>, relay=quota_postfix, delay=0.23,
delays=0.11/0/0/0.11, dsn=5.3.0, status=bounced (Command died with
signal 10: "/usr/local/etc/postfix/quota_postfix")

Aug  7 01:55:19 mail01 kernel: pid 29535 (quota_postfix), uid 125:
exited on signal 10

Here you have some extra information about the script itself and the


# ls -la /usr/local/etc/postfix/quota_postfix
-rwsr-xr-x  1 postfix  postfix  20048 Aug  4 10:18

It's got de suid flag cause it performs a "du" command and other file
operations which need permissions, although i've tried with other groups
of permissions and it eventually crashes anyway with "signal 10"



# spamfilter
spamfilter      unix    -       n       n       -       20      pipe
 flags=R user=filter argv=/home/ "localhost:10027" "antispam"
"${sender}" "${recipient}" "/usr/local/bin/spamc"

# from spamfilter to smtpd:10026
localhost:10027 inet    n       -       n       -       100       smtpd
-o content_filter=quota_postfix

# quota_postfix
quota_postfix      unix    -       n       n       -       20      pipe
 flags=R user=filter argv=/usr/local/etc/postfix/quota_postfix
"localhost" "10028" "${sender}" "${recipient}" "${domain}"

# from quota_postfix to smtpd:10028
localhost:10028 inet    n       -       n       -       100       smtpd
-o content_filter=


So far, any program which crashed would leave a ".core" file in
/usr/crash, but this one is not doing the same, so... i can't actually
debug from the core file either.
Sysctl in my FreeBSD server is ok, but i guess that postfix, somehow is
preventing this filter from generating a core file. Is that possible? Or
am i completely wrong?

How could I, at least, generate the .core file?