Skip to content

Commit

Permalink
Always take the GlobalProcessLock when using PostgresFunctionGuard (#587
Browse files Browse the repository at this point in the history
)

This fixes some really confusing segfaults that were still occurring
even after #584. Reverting #584 (while keeping this change)
re-introduces other segfaults. So both fixes are necessary.
  • Loading branch information
JelteF committed Feb 13, 2025
1 parent a2d3345 commit eb40e2f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions include/pgduckdb/pgduckdb_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ struct PostgresScopedStackReset {
template <typename Func, Func func, typename... FuncArgs>
typename std::invoke_result<Func, FuncArgs...>::type
__PostgresFunctionGuard__(const char *func_name, FuncArgs... args) {
std::lock_guard<std::recursive_mutex> lk(pgduckdb::GlobalProcessLock::GetLock());
MemoryContext ctx = CurrentMemoryContext;
ErrorData *edata = nullptr;
{ // Scope for PG_END_TRY
Expand Down

0 comments on commit eb40e2f

Please sign in to comment.