Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 44817d9

Browse files
committed
Use correct connection for cancellation in frontend's parallel slots
While waiting for slots to become available in wait_on_slots() in parallel_slot.c, the cancellation always relied on the first connection in the set to do the job. This could cause problems when this slot's socket is gone as PQgetCancel() would return NULL in this case. Rather than always using the first connection, this changes the logic to use the first valid connection for the cancellation. Author: Ranier Vilela Reviewed-by: Justin Pryzby Discussion: https://postgr.es/m/CAEudQAokk1h_pUwGXsYS4oVOuf35s1O2o3TXGHpV8=AWikvgHA@mail.gmail.com Backpatch-through: 14
1 parent d4e9bca commit 44817d9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/fe_utils/parallel_slot.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ wait_on_slots(ParallelSlotArray *sa)
237237
if (cancelconn == NULL)
238238
return false;
239239

240-
SetCancelConn(sa->slots->connection);
240+
SetCancelConn(cancelconn);
241241
i = select_loop(maxFd, &slotset);
242242
ResetCancelConn();
243243

0 commit comments

Comments
 (0)