RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1755154 - postgresql-libs - Deadlocks occur when using SSL in a multi-threaded environment
Summary: postgresql-libs - Deadlocks occur when using SSL in a multi-threaded environment
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: postgresql
Version: 7.7
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Patrik Novotný
QA Contact: Vaclav Danek
URL:
Whiteboard:
Depends On:
Blocks: 1716961
TreeView+ depends on / blocked
 
Reported: 2019-09-24 21:42 UTC by Matt Prahl
Modified: 2020-03-31 20:11 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 20:11:03 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
A patch based on the upstream patch that resolves the issue (1.42 KB, patch)
2019-09-24 21:42 UTC, Matt Prahl
no flags Details | Diff
A video showing the deadlock using the Python reproducer script (585.16 KB, video/webm)
2019-10-25 13:54 UTC, Matt Prahl
no flags Details
A modified version of the reproducer Python 2 script (1.70 KB, text/x-python)
2019-10-25 13:58 UTC, Matt Prahl
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1182 0 None None None 2020-03-31 20:11:06 UTC

Description Matt Prahl 2019-09-24 21:42:30 UTC
Created attachment 1618713 [details]
A patch based on the upstream patch that resolves the issue

Description of problem:

A deadlock occurs when connecting to Postgresql using SSL with postgresql-libs in a multi-threaded environment with other threads performing SSL independently. This issue has been causing Module Build Service (https://pagure.io/fm-orchestrator) outages, which is deployed on RHEL 7.4 but with the latest postgresql-libs package installed.

You can find a reproducer script and a more in-depth description of the issue here:
https://postgrespro.com/list/thread-id/1861629

The upstream patch that resolves this issue is here:
https://commitfest.postgresql.org/4/140/

The patch does not apply cleanly, but I attached a patch that worked for our team.


Version-Release number of selected component (if applicable):

postgresql-libs-9.2.24-1.el7_5.x86_64


How reproducible:

Easily reproducible. See the reproducer script in this upstream discussion:
https://postgrespro.com/list/thread-id/1861629


Actual results:

A deadlock occasionally occurs.


Expected results:

A deadlock does not occur.

Comment 4 Filip Januš 2019-10-25 13:01:28 UTC
Hi,
I was trying to reproduce this bug on various version of RHEL(7.4,7.7,7.8) by using attached reproducer, but I am not able to attain deadlock. Are you able to add here Your configuration? (openssl package version and pg_hba.conf).

Comment 5 Matt Prahl 2019-10-25 13:54:32 UTC
Created attachment 1629194 [details]
A video showing the deadlock using the Python reproducer script

Comment 6 Matt Prahl 2019-10-25 13:58:14 UTC
Created attachment 1629195 [details]
A modified version of the reproducer Python 2 script

Comment 7 Matt Prahl 2019-10-25 14:40:09 UTC
Hi Filip,
I attached a short video that shows the deadlock and I attached a slightly modified version of the Python 2 reproducer script that I used. It usually takes less than a couple of minutes for the deadlock to occur, but it took only a few seconds in the video I shared.

We are currently using openssl-1.0.2k-16.el7_6.1.x86_64 on the server that ran the reproducer script and on the server with Postgresql. As for the contents of pg_hba.conf, there is nothing special. We have one `hostssl` entry for MBS to connect to using a password.

Comment 8 Filip Januš 2019-10-29 15:09:28 UTC
Hi,
thank You for Your advise but still I am not able to reproduce it. But I applied attached patch and build package. Here you can download it: http://download.eng.bos.redhat.com/brewroot/work/tasks/7480/24307480/postgresql-libs-9.2.24-2.el7_7.x86_64.rpm . Please are you able to test if deadlock occur after install new package?

Comment 9 Matt Prahl 2019-10-29 18:41:47 UTC
Hi Filip,
That RPM installed fine and I can't reproduce the deadlock with it.

Comment 11 Matt Prahl 2019-10-30 14:06:13 UTC
Filip what environment do you have setup for testing the reproducer script?

Comment 12 Matt Prahl 2019-10-30 15:58:42 UTC
Filip, I created an environment using docker-compose that reproduces the issue. Please see the following repository:
https://github.com/mprahl/rhbz1755154-reproducer

Comment 20 errata-xmlrpc 2020-03-31 20:11:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1182


Note You need to log in before you can comment on or make changes to this bug.