BUG #14902: valgrind - problem in PQconnectdb - pqSaveParameterStatus reported

From: pavel(dot)bazika(at)kocovnici(dot)cz
To: pgsql-bugs(at)postgresql(dot)org
Cc: pavel(dot)bazika(at)kocovnici(dot)cz
Subject: BUG #14902: valgrind - problem in PQconnectdb - pqSaveParameterStatus reported
Date: 2017-11-13 11:27:19
Message-ID: 20171113112719.1468.57626@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The following bug has been logged on the website:

Bug reference: 14902
Logged by: Pavel Bazika
Email address: pavel(dot)bazika(at)kocovnici(dot)cz
PostgreSQL version: 10.1
Operating system: Arch Linux
Description:

Hi,

I'm testing my application with helgrind threading error detection tool
(part of valgrind) and it reports a problem in libpq, when I'm calling
PQconnectdb from two threads:

==25830== Possible data race during write of size 4 at 0x7D600CC by thread
#1
==25830== Locks held: none
==25830== at 0x7B2CFE4: pqSaveParameterStatus (fe-exec.c:1022)
==25830== by 0x7B35A01: getParameterStatus (fe-protocol3.c:1378)
==25830== by 0x7B36E77: pqParseInput3 (fe-protocol3.c:265)
==25830== by 0x7B2DD7D: PQisBusy (fe-exec.c:1738)
==25830== by 0x7B274D6: PQconnectPoll (fe-connect.c:2909)
==25830== by 0x7B2829D: connectDBComplete.part.9 (fe-connect.c:1931)
==25830== by 0x7B2B31F: connectDBComplete (fe-connect.c:589)
==25830==
==25830== This conflicts with a previous write of size 4 by thread #4
==25830== Locks held: none
==25830== at 0x7B2CFE4: pqSaveParameterStatus (fe-exec.c:1022)
==25830== by 0x7B35A01: getParameterStatus (fe-protocol3.c:1378)
==25830== by 0x7B36E77: pqParseInput3 (fe-protocol3.c:265)
==25830== by 0x7B2DD7D: PQisBusy (fe-exec.c:1738)
==25830== by 0x7B274D6: PQconnectPoll (fe-connect.c:2909)
==25830== by 0x7B2829D: connectDBComplete.part.9 (fe-connect.c:1931)
==25830== by 0x7B2B31F: connectDBComplete (fe-connect.c:589)
==25830== by 0x7B2B31F: PQconnectdb (fe-connect.c:590)

and

==25830== Possible data race during write of size 1 at 0x7D600C8 by thread
#1
==25830== Locks held: none
==25830== at 0x7B2CFC3: pqSaveParameterStatus (fe-exec.c:1027)
==25830== by 0x7B35A01: getParameterStatus (fe-protocol3.c:1378)
==25830== by 0x7B36E77: pqParseInput3 (fe-protocol3.c:265)
==25830== by 0x7B2DD7D: PQisBusy (fe-exec.c:1738)
==25830== by 0x7B274D6: PQconnectPoll (fe-connect.c:2909)
==25830== by 0x7B2829D: connectDBComplete.part.9 (fe-connect.c:1931)
==25830== by 0x7B2B31F: connectDBComplete (fe-connect.c:589)
==25830== by 0x7B2B31F: PQconnectdb (fe-connect.c:590)
==25830==
==25830== This conflicts with a previous write of size 1 by thread #4
==25830== Locks held: none
==25830== at 0x7B2CFC3: pqSaveParameterStatus (fe-exec.c:1027)
==25830== by 0x7B35A01: getParameterStatus (fe-protocol3.c:1378)
==25830== by 0x7B36E77: pqParseInput3 (fe-protocol3.c:265)
==25830== by 0x7B2DD7D: PQisBusy (fe-exec.c:1738)
==25830== by 0x7B274D6: PQconnectPoll (fe-connect.c:2909)
==25830== by 0x7B2829D: connectDBComplete.part.9 (fe-connect.c:1931)
==25830== by 0x7B2B31F: connectDBComplete (fe-connect.c:589)
==25830== by 0x7B2B31F: PQconnectdb (fe-connect.c:590)

Is this false positive, bug or am I doing something wrong? The problem
occurrs when those static variables are written in fe-exex.c.

Thanks

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message arclight1995 2017-11-13 12:23:43 BUG #14903: problem with bool array
Previous Message Amit Langote 2017-11-13 07:33:17 Re: BUG #14866: The generated constraint in the typed table causes the server to crash