You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
When I was reading the source code of pg_show_plans, I found that the usage of the spin lock pgsp_tmp_entry->mutex in the pg_show_plans function is inappropriate. Spinlock is very lightweight lock, so the reasonable usage should involve performing some simple logical operations while holding the spin lock. However, in the pg_show_plans function, the spin lock pgsp_tmp_entry->mutex is held during the execution of the heap_form_tuple operation, which could handle interrupt signals (e.g., multiple calls to ereport). This could result in spin lock leakage.
In my opinion, the mutex in pgspEntry is only used to protect n_plans. Therefore, it might be more appropriate to add a member n_plans in pgspCtx to record the n_plans information when pgsp_tmp_entry is acquired. And then, Release the spinlock. Please refer to the v1.patch for more details.
Regards.
The text was updated successfully, but these errors were encountered:
Hello,
When I was reading the source code of
pg_show_plans
, I found that the usage of the spin lockpgsp_tmp_entry->mutex
in thepg_show_plans
function is inappropriate. Spinlock is very lightweight lock, so the reasonable usage should involve performing some simple logical operations while holding the spin lock. However, in thepg_show_plans
function, the spin lockpgsp_tmp_entry->mutex
is held during the execution of theheap_form_tuple
operation, which could handle interrupt signals (e.g., multiple calls toereport
). This could result in spin lock leakage.In my opinion, the
mutex
inpgspEntry
is only used to protectn_plans
. Therefore, it might be more appropriate to add a membern_plans
inpgspCtx
to record the n_plans information whenpgsp_tmp_entry
is acquired. And then, Release the spinlock. Please refer to the v1.patch for more details.Regards.
The text was updated successfully, but these errors were encountered: