forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit878aa41
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 parent419cac0 commit878aa41
3 files changed
+40
-25
lines changedLines changed: 36 additions & 17 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2112 | 2112 |
| |
2113 | 2113 |
| |
2114 | 2114 |
| |
2115 |
| - | |
2116 |
| - | |
2117 |
| - | |
2118 |
| - | |
2119 |
| - | |
2120 |
| - | |
2121 |
| - | |
2122 |
| - | |
2123 |
| - | |
2124 |
| - | |
2125 |
| - | |
2126 |
| - | |
2127 | 2115 |
| |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
2128 | 2121 |
| |
2129 | 2122 |
| |
2130 | 2123 |
| |
| |||
3007 | 3000 |
| |
3008 | 3001 |
| |
3009 | 3002 |
| |
3010 |
| - | |
3011 |
| - | |
| 3003 | + | |
| 3004 | + | |
| 3005 | + | |
| 3006 | + | |
| 3007 | + | |
| 3008 | + | |
| 3009 | + | |
| 3010 | + | |
| 3011 | + | |
| 3012 | + | |
| 3013 | + | |
| 3014 | + | |
| 3015 | + | |
| 3016 | + | |
| 3017 | + | |
3012 | 3018 |
| |
3013 | 3019 |
| |
3014 |
| - | |
| 3020 | + | |
3015 | 3021 |
| |
3016 | 3022 |
| |
3017 | 3023 |
| |
3018 | 3024 |
| |
3019 | 3025 |
| |
3020 | 3026 |
| |
3021 |
| - | |
| 3027 | + | |
| 3028 | + | |
| 3029 | + | |
| 3030 | + | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
3022 | 3041 |
| |
3023 | 3042 |
| |
3024 | 3043 |
| |
3025 | 3044 |
| |
3026 | 3045 |
| |
3027 | 3046 |
| |
3028 | 3047 |
| |
3029 |
| - | |
| 3048 | + | |
3030 | 3049 |
| |
3031 | 3050 |
| |
3032 | 3051 |
| |
|
Lines changed: 2 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
236 | 236 |
| |
237 | 237 |
| |
238 | 238 |
| |
239 |
| - | |
240 |
| - | |
241 |
| - | |
242 |
| - | |
243 |
| - | |
244 |
| - | |
245 |
| - | |
| 239 | + | |
| 240 | + | |
246 | 241 |
| |
247 | 242 |
| |
248 | 243 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
705 | 705 |
| |
706 | 706 |
| |
707 | 707 |
| |
708 |
| - | |
| 708 | + | |
| 709 | + | |
709 | 710 |
| |
710 | 711 |
| |
711 | 712 |
| |
|
0 commit comments
Comments
(0)