forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit407580a
committed
In libpq for Windows, call WSAStartup once and WSACleanup not at all.
The Windows documentation insists that every WSAStartup call shouldhave a matching WSACleanup call. However, if that ever had actualrelevance, it wasn't in this century. Every remotely-modern Windowskernel is capable of cleaning up when a process exits without doingthat, and must be so to avoid resource leaks in case of a processcrash. Moreover, Postgres backends have done WSAStartup withoutWSACleanup since commit4cdf51e in 2004, and we've never seen anyindication of a problem with that.libpq's habit of doing WSAStartup during connection start andWSACleanup during shutdown is also rather inefficient, since aseries of non-overlapping connection requests leads to repeated,quite expensive DLL unload/reload cycles. We document a workaroundfor that (having the application call WSAStartup for itself), butthat's just a kluge. It's also worth noting that it's far fromuncommon for applications to exit without doing PQfinish, andwe've not heard reports of trouble from that either.However, the real reason for acting on this is that recentexperiments by Alexander Lakhin show that calling WSACleanupduring PQfinish is triggering the symptom we occasionally seethat a process using libpq fails to emit expected stdio output.Therefore, let's change libpq so that it calls WSAStartup onlyonce per process, during the first connection attempt, and nevercalls WSACleanup at all.While at it, get rid of the only other WSACleanup call in our codetree, in pg_dump/parallel.c; that presumably is equally useless.Back-patch of HEAD commit7d00a6b.Discussion:https://postgr.es/m/ac976d8c-03df-d6b8-025c-15a2de8d9af1@postgrespro.ru1 parentf0e92bc commit407580a
File tree
3 files changed
+18
-44
lines changed- doc/src/sgml
- src
- bin/pg_dump
- interfaces/libpq
3 files changed
+18
-44
lines changedLines changed: 0 additions & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
91 | 91 |
| |
92 | 92 |
| |
93 | 93 |
| |
94 |
| - | |
95 |
| - | |
96 |
| - | |
97 |
| - | |
98 |
| - | |
99 |
| - | |
100 |
| - | |
101 |
| - | |
102 |
| - | |
103 |
| - | |
104 |
| - | |
105 |
| - | |
106 |
| - | |
107 |
| - | |
108 |
| - | |
109 | 94 |
| |
110 | 95 |
| |
111 | 96 |
| |
|
Lines changed: 1 addition & 15 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
230 | 230 |
| |
231 | 231 |
| |
232 | 232 |
| |
233 |
| - | |
234 |
| - | |
235 |
| - | |
236 |
| - | |
237 |
| - | |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 | 233 |
| |
247 | 234 |
| |
248 | 235 |
| |
| |||
268 | 255 |
| |
269 | 256 |
| |
270 | 257 |
| |
271 |
| - | |
272 |
| - | |
| 258 | + | |
273 | 259 |
| |
274 | 260 |
| |
275 | 261 |
| |
|
Lines changed: 17 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3802 | 3802 |
| |
3803 | 3803 |
| |
3804 | 3804 |
| |
3805 |
| - | |
| 3805 | + | |
| 3806 | + | |
| 3807 | + | |
| 3808 | + | |
| 3809 | + | |
3806 | 3810 |
| |
3807 |
| - | |
| 3811 | + | |
3808 | 3812 |
| |
3809 |
| - | |
3810 |
| - | |
| 3813 | + | |
| 3814 | + | |
| 3815 | + | |
| 3816 | + | |
| 3817 | + | |
| 3818 | + | |
| 3819 | + | |
| 3820 | + | |
| 3821 | + | |
| 3822 | + | |
3811 | 3823 |
| |
3812 |
| - | |
| 3824 | + | |
3813 | 3825 |
| |
3814 | 3826 |
| |
3815 | 3827 |
| |
3816 |
| - | |
3817 |
| - | |
3818 |
| - | |
3819 |
| - | |
3820 | 3828 |
| |
3821 |
| - | |
3822 | 3829 |
| |
3823 | 3830 |
| |
3824 | 3831 |
| |
| |||
3994 | 4001 |
| |
3995 | 4002 |
| |
3996 | 4003 |
| |
3997 |
| - | |
3998 |
| - | |
3999 |
| - | |
4000 |
| - | |
4001 | 4004 |
| |
4002 | 4005 |
| |
4003 | 4006 |
| |
|
0 commit comments
Comments
(0)