forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf896818
committed
Fix handling of errors in libpq pipelines
The logic to keep the libpq command queue in sync with queries that havebeen processed had a bug when errors were returned for reasons otherthan problems in queries -- for example, when a connection is lost. Weincorrectly consumed an element from the command queue every time, butthis is wrong and can lead to the queue becoming empty ahead of time,leading to later malfunction: PQgetResult would return nothing,potentially causing the calling application to enter a busy loop.Fix by making the SYNC queue element a barrier that can only be consumedwhen a SYNC message is received.Backpatch to 14.Reported by: Иван Трофимов (Ivan Trofimov) <i.trofimow@yandex.ru>Discussion:https://postgr.es/m/17948-fcace7557e449957@postgresql.org1 parentbe7b4d9 commitf896818
3 files changed
+49
-33
lines changedLines changed: 41 additions & 22 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2078 | 2078 |
| |
2079 | 2079 |
| |
2080 | 2080 |
| |
2081 |
| - | |
2082 |
| - | |
2083 |
| - | |
2084 |
| - | |
| 2081 | + | |
| 2082 | + | |
| 2083 | + | |
2085 | 2084 |
| |
2086 | 2085 |
| |
2087 | 2086 |
| |
2088 | 2087 |
| |
2089 | 2088 |
| |
2090 | 2089 |
| |
2091 | 2090 |
| |
2092 |
| - | |
2093 |
| - | |
2094 |
| - | |
2095 |
| - | |
2096 |
| - | |
2097 |
| - | |
2098 |
| - | |
2099 |
| - | |
2100 |
| - | |
2101 |
| - | |
2102 |
| - | |
2103 |
| - | |
2104 | 2091 |
| |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
2105 | 2097 |
| |
2106 | 2098 |
| |
2107 | 2099 |
| |
| |||
2165 | 2157 |
| |
2166 | 2158 |
| |
2167 | 2159 |
| |
2168 |
| - | |
| 2160 | + | |
2169 | 2161 |
| |
2170 | 2162 |
| |
2171 | 2163 |
| |
| |||
3027 | 3019 |
| |
3028 | 3020 |
| |
3029 | 3021 |
| |
3030 |
| - | |
3031 |
| - | |
| 3022 | + | |
| 3023 | + | |
| 3024 | + | |
| 3025 | + | |
| 3026 | + | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
3032 | 3037 |
| |
3033 | 3038 |
| |
3034 |
| - | |
| 3039 | + | |
3035 | 3040 |
| |
3036 | 3041 |
| |
3037 | 3042 |
| |
3038 | 3043 |
| |
3039 | 3044 |
| |
3040 | 3045 |
| |
3041 |
| - | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
| 3050 | + | |
| 3051 | + | |
| 3052 | + | |
| 3053 | + | |
| 3054 | + | |
| 3055 | + | |
| 3056 | + | |
| 3057 | + | |
| 3058 | + | |
| 3059 | + | |
3042 | 3060 |
| |
3043 | 3061 |
| |
3044 | 3062 |
| |
3045 | 3063 |
| |
3046 | 3064 |
| |
3047 | 3065 |
| |
3048 | 3066 |
| |
3049 |
| - | |
| 3067 | + | |
3050 | 3068 |
| |
3051 | 3069 |
| |
3052 | 3070 |
| |
| |||
3070 | 3088 |
| |
3071 | 3089 |
| |
3072 | 3090 |
| |
| 3091 | + | |
3073 | 3092 |
| |
3074 | 3093 |
| |
3075 | 3094 |
| |
|
Lines changed: 6 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
240 | 240 |
| |
241 | 241 |
| |
242 | 242 |
| |
243 |
| - | |
244 |
| - | |
245 |
| - | |
246 |
| - | |
247 |
| - | |
248 |
| - | |
249 |
| - | |
| 243 | + | |
| 244 | + | |
250 | 245 |
| |
251 | 246 |
| |
252 | 247 |
| |
| |||
287 | 282 |
| |
288 | 283 |
| |
289 | 284 |
| |
| 285 | + | |
290 | 286 |
| |
291 | 287 |
| |
292 | 288 |
| |
293 |
| - | |
294 |
| - | |
| 289 | + | |
| 290 | + | |
295 | 291 |
| |
296 | 292 |
| |
297 | 293 |
| |
298 | 294 |
| |
299 | 295 |
| |
300 | 296 |
| |
301 | 297 |
| |
302 |
| - | |
| 298 | + | |
303 | 299 |
| |
304 | 300 |
| |
305 | 301 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
656 | 656 |
| |
657 | 657 |
| |
658 | 658 |
| |
659 |
| - | |
| 659 | + | |
| 660 | + | |
660 | 661 |
| |
661 | 662 |
| |
662 | 663 |
| |
|
0 commit comments
Comments
(0)