Aw: BUG #18312: libpq: PQsetdbLogin() not thread-safe

Christian Maurer <c.maurer@gmx.at>

From: Christian Maurer <c.maurer@gmx.at>
To: pgsql-bugs@lists.postgresql.org
Date: 2024-02-02T10:10:54Z
Lists: pgsql-bugs

Attachments

<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi</div>

<div>&nbsp;</div>

<div>I managed to capture a stack trace for the crash via WinDbg:</div>

<div>&nbsp;</div>

<div>Frame Index&nbsp;&nbsp; &nbsp; &nbsp;Call Site&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Child-SP&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;Return Address<br/>
[0x0] &nbsp; &nbsp; &nbsp; &nbsp; ntdll!NtTerminateProcess+0x14 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9fdf88 &nbsp; 0x7fffce3cda98<br/>
[0x1] &nbsp; &nbsp; &nbsp; &nbsp; ntdll!RtlExitUserProcess+0xb8 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9fdf90 &nbsp; 0x7fffcd99e82b<br/>
[0x2] &nbsp; &nbsp; &nbsp; &nbsp; KERNEL32!ExitProcessImplementation+0xb &nbsp; 0x18aa9fdfc0 &nbsp; 0x7fffcd42a155<br/>
[0x3] &nbsp; &nbsp; &nbsp; &nbsp; msvcrt!_crtExitProcess+0x15 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9fdff0 &nbsp; 0x7fffcd42a7c5<br/>
[0x4] &nbsp; &nbsp; &nbsp; &nbsp; msvcrt!doexit+0x171 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9fe020 &nbsp; 0x7fffcd41f26d<br/>
[0x5] &nbsp; &nbsp; &nbsp; &nbsp; msvcrt!abort+0x8d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9fe090 &nbsp; 0x68281886<br/>
[0x6] &nbsp; &nbsp; &nbsp; &nbsp; libintl_9!libintl_bindtextdomain+0x56 &nbsp; &nbsp;0x18aa9fe640 &nbsp; 0x7fff7dcd2e93<br/>
[0x7] &nbsp; &nbsp; &nbsp; &nbsp; LIBPQ!PQenv2encoding+0x1193 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9fe670 &nbsp; 0x7fff7dcd2c9e<br/>
[0x8] &nbsp; &nbsp; &nbsp; &nbsp; LIBPQ!PQenv2encoding+0xf9e &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x18aa9fe6a0 &nbsp; 0x7fff7dcc9263<br/>
[0x9] &nbsp; &nbsp; &nbsp; &nbsp; LIBPQ!PQpingParams+0x2ea3 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9fe6d0 &nbsp; 0x7fff7dcc3dcd<br/>
[0xa] &nbsp; &nbsp; &nbsp; &nbsp; LIBPQ!PQconnectPoll+0x90d &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9feb50 &nbsp; 0x7fff7dcc6a1c<br/>
[0xb] &nbsp; &nbsp; &nbsp; &nbsp; LIBPQ!PQpingParams+0x65c &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x18aa9ff5c0 &nbsp; 0x7fff7dcc50eb<br/>
[0xc] &nbsp; &nbsp; &nbsp; &nbsp; LIBPQ!PQsetdbLogin+0x19b &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0x18aa9ff5f0 &nbsp; 0x7ff774798078<br/>
[0xd] &nbsp; &nbsp; &nbsp; &nbsp; _HelloWorld!test+0x98 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;0x18aa9ff620 &nbsp; 0x7ff774796f17</div>

<div>&nbsp;</div>

<div>It seems to me, that it is related to&nbsp;BUG #17299</div>

<div>&nbsp;</div>

<div>Regards,</div>

<div>Christian Maurer<br/>
<br/>
<br/>
&nbsp;</div></div></body></html>



Commits

  1. Avoid concurrent calls to bindtextdomain().