From owner-freebsd-questions@FreeBSD.ORG Mon Aug 11 09:31:25 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6E3D91065670 for ; Mon, 11 Aug 2008 09:31:25 +0000 (UTC) (envelope-from jordi@cdmon.com) Received: from correo.cdmon.com (correo.cdmon.com [212.36.74.112]) by mx1.freebsd.org (Postfix) with ESMTP id 12D328FC25 for ; Mon, 11 Aug 2008 09:31:25 +0000 (UTC) (envelope-from jordi@cdmon.com) Received: from localhost (localhost.cdmon.com [127.0.0.1]) by correo.cdmon.com (Postfix) with ESMTP id EBD03130EFA; Mon, 11 Aug 2008 11:31:23 +0200 (CEST) X-Spam-Flag: NO X-Spam-Score: 1.133 X-Spam-Level: * X-Spam-Status: No, score=1.133 required=5.9 tests=[AWL=-2.507, BAYES_50=0.001, FH_HOST_ALMOST_IP=1.751, MISSING_HEADERS=1.292, SPF_SOFTFAIL=0.596] Received: from correo.cdmon.com ([127.0.0.1]) by localhost (correo.cdmon.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id sqOFGRYWAVW2; Mon, 11 Aug 2008 11:31:15 +0200 (CEST) Received: from [192.168.0.174] (62.Red-217-126-43.staticIP.rima-tde.net [217.126.43.62]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by correo.cdmon.com (Postfix) with ESMTP id A6511131087; Mon, 11 Aug 2008 11:31:14 +0200 (CEST) Message-ID: <48A006DD.4030300@cdmon.com> Date: Mon, 11 Aug 2008 11:31:09 +0200 From: Jordi Moles Blanco User-Agent: Thunderbird 2.0.0.16 (X11/20080724) MIME-Version: 1.0 References: <489ACAB8.7000503@cdmon.com> <489B2689.8070209@mahan.org> <489BF19D.1010804@cdmon.com> In-Reply-To: <489BF19D.1010804@cdmon.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-questions@freebsd.org, Patrick Mahan Subject: Re: problems with a C script, exiting with signal 10 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: jordi@cdmon.com List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Aug 2008 09:31:25 -0000 Hi, i've been trying to debug what you suggested, but no luck so far :( The thing is that i checked out all the calls to arrays, space handling and so on, and i couldn't find anything wrong. After that, i ended up trying the "hard" way, which is to keep a file /tmp/debug.log where the script writes everything that it does. So... the problem was that even in those cases when postfix logged a "signal 10" error, the logs showed that the C script got to the end of the file, it executed every single line, it doesn't get stuck manipulating arrays or anything like that. any idea? Thanks. En/na Jordi Moles Blanco ha escrit: > Hi, > > thanks for the reply, i will have a close look at what you suggested. > The thing is that, yes, i work with arrays, pointers, mallocs and so > on. I'll try to make sure everything is initiliazed properly before > being used. > > Thanks for the advice. > > > > > En/na Patrick Mahan ha escrit: >> >> >> Jordi Moles Blanco presented these words - circa 8/7/08 3:13 AM-> >>> Hi, >>> >>> 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: >>> >>> >>> ******/var/log/maillog******** >>> Aug 7 01:55:19 mail01 postfix/pipe[27534]: 3E1A0143709: >>> to=, 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") >>> >>> >>> *****/var/log/messages******* >>> Aug 7 01:55:19 mail01 kernel: pid 29535 (quota_postfix), uid 125: >>> exited on signal 10 >>> >> >> Well signal 10 is SIGBUS which is indicative of (generally) a bad >> address, >> non-aligned memory address (on platforms it matters) or a hardware >> error. >> I would look for places you are dereferencing a pointer without perhaps >> first validating it. >> >> Given that it rarely occurs, I might suspect that you are allocating >> some >> memory, but failing to completely initialize (malloc() doesn't zero out >> memory) it or assuming it is already initialize. >> >> Good luck, >> >> Patrick >>> >>> Here you have some extra information about the script itself and the >>> master.cf >>> >>> >>> *****/usr/local/etc/postfix/quota_postfix*** >>> >>> # ls -la /usr/local/etc/postfix/quota_postfix >>> -rwsr-xr-x 1 postfix postfix 20048 Aug 4 10:18 >>> /usr/local/etc/postfix/quota_postfix >>> >>> 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" >>> >>> ******master.cf********* >>> >>> ......... >>> >>> # spamfilter >>> spamfilter unix - n n - 20 pipe >>> flags=R user=filter argv=/home/antispam.pl "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? >>> >>> Thanks. >>> >>> >>> _______________________________________________ >>> freebsd-questions@freebsd.org mailing list >>> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >>> To unsubscribe, send any mail to >>> "freebsd-questions-unsubscribe@freebsd.org" >>> >>> > > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscribe@freebsd.org"