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 5233684A.2040505@vmware.com
Whole thread Raw
In response to Re: Strange hanging bug in a simple milter  (Heikki Linnakangas <hlinnakangas@vmware.com>)
Responses Re: Strange hanging bug in a simple milter
List pgsql-hackers
On 13.09.2013 22:26, Heikki Linnakangas wrote:
> 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.

Actually, I think there's a pre-existing bug there in git master. If the 
SSL_set_app_data or SSL_set_fd call in pqsecure_open_client fails for 
some reason, it will call close_SSL() with conn->ssl already set, and 
the mutex held. close_SSL() will call 
pqsecure_destroy()->destroy_SSL()->destory_ssl_system(), which will try 
to acquire the mutex again.

- Heikki



pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: Strange hanging bug in a simple milter
Next
From: Robert Haas
Date:
Subject: Re: dynamic shared memory