Re: Strange hanging bug in a simple milter - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Strange hanging bug in a simple milter
Date
Msg-id 523366CF.6030801@vmware.com
Whole thread Raw
In response to Re: Strange hanging bug in a simple milter  (Stephen Frost <sfrost@snowman.net>)
Responses Re: Strange hanging bug in a simple milter
Re: Strange hanging bug in a simple milter
List pgsql-hackers
On 13.09.2013 22:03, Stephen Frost wrote:
> * Andres Freund (andres@2ndquadrant.com) wrote:
>> It seems slightly cleaner to just move the pqsecure_destroy(); to the
>> end of that function, based on a boolean. But if you think otherwise, I
>> won't protest...
>
> Hmm, agreed; I had originally been concerned that the SIGPIPE madness
> needed to be around the pqsecure_destroy() call, but I can't see why
> that would be.
>
> I've run through a few times w/ the attached and haven't seen the
> deadlock.  Will continue testing, of course.
>
> Heikki, any thoughts regarding this change?  Any concerns about
> back-patching it?

Umm, with that patch, pqsecure_destroy() is never called. The "if 
(conn->ssl)" test that's now at the end of the close_SSL function is 
never true, because conn->ssl is set to NULL earlier.

I'm afraid the "move_locks.diff" patch you posted earlier is also 
broken; close_SSL() is called in error scenarios from 
pqsecure_open_client(), while already holding the mutex. So it will 
deadlock with itself if the connection cannot be established.

- Heikki



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: INSERT...ON DUPLICATE KEY LOCK FOR UPDATE
Next
From: Heikki Linnakangas
Date:
Subject: Re: Strange hanging bug in a simple milter