At 2026-06-29 17:27:17,"Rafia Sabih" <[email protected]>  wrote  :


>I understand your concern and I tried to solve it by passing fsstate now,
>also saving a backpointer to the node in active_fsstate to solve the issue
>with make_tuple_from_result_row. Since we need to have conn from fsstate, I
>am not sure how we can do that if we have only active_fsstate passed to the
>function.


I have reviewed all your previous patch revisions and tested the v12 patch.
You have fixed the issue raised by Robert where active_scan was not cleared 
when it ought to have been.
However, in my opinion, active_scan is cleared prematurely before the drain 
loop finishes executing.
If an error occurs mid-drain (such as query cancellation), the connection 
remains in an in-flight query state with no active_scan referencing it.
In the subsequent postgresEndForeignScan, is_active_scan() will return false, 
so pgfdw_cancel_scan() will never be invoked.
In subsequent queries, conn_state->active_scan may become a dangling pointer, 
triggering a crash.
I have written a test case that reproduces this crash to confirm the bug.










Best regards,

--

Yilin Zhang



Reply via email to