forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit31f8d62
committed
Preserve CurrentMemoryContext across notify and sinval interrupts.
ProcessIncomingNotify is called from the main processing loop thatnormally runs in MessageContext. That outer-loop code assumes thatwhatever it allocates will be cleaned up when we're done processingthe current client message --- but if we service a notify interrupt,then whatever gets allocated before the next switch intoMessageContext will be permanently leaked in TopMemoryContext,because CommitTransactionCommand sets CurrentMemoryContext toTopMemoryContext. There are observable leaks associated with(at least) encoding conversion of incoming queries and parametersattached to Bind messages.sinval catchup interrupts have a similar problem. There might beothers, but I've not identified any other clear cases.To fix, take care to save and restore CurrentMemoryContext acrossthe Start/CommitTransactionCommand calls in these functions.Per bug #18512 from wizardbrony. Commit to back branches only;in HEAD, this was dealt with by the riskier but more thoroughgoingapproach in commit1afe31f.Discussion:https://postgr.es/m/3478884.1718656625@sss.pgh.pa.us1 parent6d2ac55 commit31f8d62
2 files changed
+17
-1
lines changedLines changed: 10 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
2182 | 2182 |
| |
2183 | 2183 |
| |
2184 | 2184 |
| |
| 2185 | + | |
| 2186 | + | |
2185 | 2187 |
| |
2186 | 2188 |
| |
2187 | 2189 |
| |
| |||
2196 | 2198 |
| |
2197 | 2199 |
| |
2198 | 2200 |
| |
2199 |
| - | |
| 2201 | + | |
| 2202 | + | |
2200 | 2203 |
| |
| 2204 | + | |
| 2205 | + | |
2201 | 2206 |
| |
2202 | 2207 |
| |
2203 | 2208 |
| |
2204 | 2209 |
| |
2205 | 2210 |
| |
2206 | 2211 |
| |
| 2212 | + | |
| 2213 | + | |
| 2214 | + | |
| 2215 | + | |
2207 | 2216 |
| |
2208 | 2217 |
| |
2209 | 2218 |
| |
|
Lines changed: 7 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
16 | 16 |
| |
17 | 17 |
| |
18 | 18 |
| |
| 19 | + | |
19 | 20 |
| |
20 | 21 |
| |
21 | 22 |
| |
| |||
182 | 183 |
| |
183 | 184 |
| |
184 | 185 |
| |
| 186 | + | |
185 | 187 |
| |
186 | 188 |
| |
187 | 189 |
| |
| |||
195 | 197 |
| |
196 | 198 |
| |
197 | 199 |
| |
| 200 | + | |
| 201 | + | |
198 | 202 |
| |
199 | 203 |
| |
200 | 204 |
| |
| 205 | + | |
| 206 | + | |
| 207 | + | |
201 | 208 |
| |
202 | 209 |
| |
203 | 210 |
|
0 commit comments
Comments
(0)