forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit1171c6e
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 parent25f2a43 commit1171c6e
3 files changed
+44
-29
lines changedLines changed: 40 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2119 | 2119 |
| |
2120 | 2120 |
| |
2121 | 2121 |
| |
2122 |
| - | |
2123 |
| - | |
2124 |
| - | |
2125 |
| - | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
2126 | 2125 |
| |
2127 | 2126 |
| |
2128 | 2127 |
| |
2129 | 2128 |
| |
2130 | 2129 |
| |
2131 | 2130 |
| |
2132 |
| - | |
2133 |
| - | |
2134 |
| - | |
2135 |
| - | |
2136 |
| - | |
2137 |
| - | |
2138 |
| - | |
2139 |
| - | |
2140 |
| - | |
2141 |
| - | |
2142 |
| - | |
2143 |
| - | |
2144 | 2131 |
| |
| 2132 | + | |
| 2133 | + | |
| 2134 | + | |
| 2135 | + | |
| 2136 | + | |
2145 | 2137 |
| |
2146 | 2138 |
| |
2147 | 2139 |
| |
| |||
3040 | 3032 |
| |
3041 | 3033 |
| |
3042 | 3034 |
| |
3043 |
| - | |
3044 |
| - | |
| 3035 | + | |
| 3036 | + | |
| 3037 | + | |
| 3038 | + | |
| 3039 | + | |
| 3040 | + | |
| 3041 | + | |
| 3042 | + | |
| 3043 | + | |
| 3044 | + | |
| 3045 | + | |
| 3046 | + | |
| 3047 | + | |
| 3048 | + | |
| 3049 | + | |
3045 | 3050 |
| |
3046 | 3051 |
| |
3047 |
| - | |
| 3052 | + | |
3048 | 3053 |
| |
3049 | 3054 |
| |
3050 | 3055 |
| |
3051 | 3056 |
| |
3052 | 3057 |
| |
3053 | 3058 |
| |
3054 |
| - | |
| 3059 | + | |
| 3060 | + | |
| 3061 | + | |
| 3062 | + | |
| 3063 | + | |
| 3064 | + | |
| 3065 | + | |
| 3066 | + | |
| 3067 | + | |
| 3068 | + | |
| 3069 | + | |
| 3070 | + | |
| 3071 | + | |
| 3072 | + | |
3055 | 3073 |
| |
3056 | 3074 |
| |
3057 | 3075 |
| |
3058 | 3076 |
| |
3059 | 3077 |
| |
3060 | 3078 |
| |
3061 | 3079 |
| |
3062 |
| - | |
| 3080 | + | |
3063 | 3081 |
| |
3064 | 3082 |
| |
3065 | 3083 |
| |
| |||
3083 | 3101 |
| |
3084 | 3102 |
| |
3085 | 3103 |
| |
| 3104 | + | |
3086 | 3105 |
| |
3087 | 3106 |
| |
3088 | 3107 |
| |
|
Lines changed: 2 additions & 7 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 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
673 | 673 |
| |
674 | 674 |
| |
675 | 675 |
| |
676 |
| - | |
| 676 | + | |
| 677 | + | |
677 | 678 |
| |
678 | 679 |
| |
679 | 680 |
| |
|
0 commit comments
Comments
(0)