Hello PostgreSQL gurus, (I have already posted a very similar message to comp.mail.sendmail newsgroup on August 22nd, but I haven't received any responses there. I have also tried pgsql-interfa...@postgresql.org but to no avail. Solving this problem requires some Sendmail/Postfix experience because the MTA needs to be configured to use the authmilter. Also some basic Milter API knowledge is needed: https://www.milter.org/developers/api/index)
I have come across a very strange bug and I do not understand why it is occurring. Fortunately it is reproducible in a pretty deterministic manner. The goal: to create a milter for limiting how many nrcpts an authenticated user can send in a 24 hour time interval. The related data is stored in a PostgreSQL database. The problem: my alpha-stage code for authmilter simply hangs when processing two concurrent connections from Sendmail. For authmilter-simplified, I have removed the callbacks envfrom and envrcpt, because they are not needed in order to demonstrate the bug. 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 have tested authmilter on Ubuntu Linux 12.04 having packages: libmilter-dev 8.14.4-2ubuntu2 libmilter1.0.1 8.14.4-2ubuntu2 libpq-dev 9.1.9-0ubuntu12.04 libpq5 9.1.9-0ubuntu12.04 postgresql-9.1 9.1.9-0ubuntu12.04 postgresql-client-9.1 9.1.9-0ubuntu12.04 postgresql-client-common 129ubuntu1 postgresql-common 129ubuntu1 postgresql-contrib-9.1 9.1.9-0ubuntu12.04 postgresql-doc-9.1 9.1.9-0ubuntu12.04 postgresql-server-dev-9.1 9.1.9-0ubuntu12.04 postgresql-server-dev-all 129ubuntu1 sendmail 8.14.4-2ubuntu2 sendmail-base 8.14.4-2ubuntu2 sendmail-bin 8.14.4-2ubuntu2 sendmail-cf 8.14.4-2ubuntu2 sendmail-doc 8.14.4-2ubuntu2 I suspect there could be something wrong with libpq and libmilter working together, but I am not sure. Many thanks for any help you can provide. PS. I installed PostgreSQL 9.3rc1 and linked my milter against the libpq that comes with that version. The hanging bug still occurs. Regards, vmk -- ************************************************************************ Tietotekniikkakeskus / Helsingin yliopisto IT department / University of Helsinki ************************************************************************ -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers