Re: Strange hanging bug in a simple milter

From: Heikki Linnakangas <hlinnakangas(at)vmware(dot)com>
To: Vesa-Matti J Kari <vmkari(at)cc(dot)helsinki(dot)fi>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Strange hanging bug in a simple milter
Date: 2013-09-09 11:58:43
Message-ID: 522DB7F3.2010203@vmware.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09.09.2013 09:34, Vesa-Matti J Kari wrote:
> Basically all that the authmilter now does is to connect to PostgreSQL in
> authmilt_connect() and close the connection in authmilt_close(). Based on
> the authmilter debug logging it seems to me that when the hanging occurs,
> the authmilter never completes PQsetdbLogin().
>
> Based on the document
>
> http://www.postgresql.org/docs/9.1/interactive/libpq-threading.html
>
> I am sure libpq should be thread safe and on startup
> the authmilter verifies that the libpq is indeed thread safe.
>
>
> If you think you could set up a test enviroment using:
>
> - Sendmail (or maybe Postfix)
> - authmilter
> - PostgreSQL
>
> here is an authmilter-simplied.tar.gz package for you:
>
> http://www.helsinki.fi/~vmkari/authmilter-simplified.tar.gz
>
> The README file contains a rough instructions outline on how to setup
> things in order to reproduce the strange hanging bug.
>
>
> Please note that when running two test message sender scripts in parallel,
> the bug does not occur immediately, but only after between 1 to 5 minutes
> of processing. Sometimes it may take even longer.

I managed to set that up and got it running. But it works fine for me,
does not hang.

I'd suggest poking around with gdb, to see where it hangs. Also, run
"select * from pg_stat_activity" from a psql session to see what's
happening inside the database. log_connections=on and
log_disconnections=on would also be a good idea.

PS. You'll need to escape the strings in the queries, to avoid SQL
injection.

- Heikki

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message MauMau 2013-09-09 12:29:44 Is this a correct recommendation for Solaris 10 kernel settings?
Previous Message MauMau 2013-09-09 11:14:25 Re: [bug fix] strerror() returns ??? in a UTF-8/C database with LC_MESSAGES=non-ASCII