forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit7d00a6b
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 suggest that calling WSACleanupduring PQfinish might be 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.If this proves to suppress the fairly-common ecpg test failureswe see on Windows, I'll back-patch, but for now let's just do itin HEAD and see what happens.Discussion:https://postgr.es/m/ac976d8c-03df-d6b8-025c-15a2de8d9af1@postgrespro.ru1 parent5408498 commit7d00a6b
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 | |
---|---|---|---|
| |||
229 | 229 |
| |
230 | 230 |
| |
231 | 231 |
| |
232 |
| - | |
233 |
| - | |
234 |
| - | |
235 |
| - | |
236 |
| - | |
237 |
| - | |
238 |
| - | |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 | 232 |
| |
246 | 233 |
| |
247 | 234 |
| |
| |||
267 | 254 |
| |
268 | 255 |
| |
269 | 256 |
| |
270 |
| - | |
271 |
| - | |
| 257 | + | |
272 | 258 |
| |
273 | 259 |
| |
274 | 260 |
| |
|
Lines changed: 17 additions & 14 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3871 | 3871 |
| |
3872 | 3872 |
| |
3873 | 3873 |
| |
3874 |
| - | |
| 3874 | + | |
| 3875 | + | |
| 3876 | + | |
| 3877 | + | |
| 3878 | + | |
3875 | 3879 |
| |
3876 |
| - | |
| 3880 | + | |
3877 | 3881 |
| |
3878 |
| - | |
3879 |
| - | |
| 3882 | + | |
| 3883 | + | |
| 3884 | + | |
| 3885 | + | |
| 3886 | + | |
| 3887 | + | |
| 3888 | + | |
| 3889 | + | |
| 3890 | + | |
| 3891 | + | |
3880 | 3892 |
| |
3881 |
| - | |
| 3893 | + | |
3882 | 3894 |
| |
3883 | 3895 |
| |
3884 | 3896 |
| |
3885 |
| - | |
3886 |
| - | |
3887 |
| - | |
3888 |
| - | |
3889 | 3897 |
| |
3890 |
| - | |
3891 | 3898 |
| |
3892 | 3899 |
| |
3893 | 3900 |
| |
| |||
4080 | 4087 |
| |
4081 | 4088 |
| |
4082 | 4089 |
| |
4083 |
| - | |
4084 |
| - | |
4085 |
| - | |
4086 |
| - | |
4087 | 4090 |
| |
4088 | 4091 |
| |
4089 | 4092 |
| |
|
0 commit comments
Comments
(0)