Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3acc4ac

Browse files
committed
LLVMJIT: Release JIT context after running ExprContext shutdown callbacks.
Due to inlining it previously was possible that an ExprContext'sshutdown callback pointed to a JITed function. As the JIT contextpreviously was shut down before the shutdown callbacks were called,that could lead to segfaults. Fix the ordering.Reported-By: Dmitry DolgovAuthor: Andres FreundDiscussion:https://postgr.es/m/CA+q6zcWO7CeAJtHBxgcHn_hj+PenM=tvG0RJ93X1uEJ86+76Ug@mail.gmail.comBackpatch: 11-, where JIT compilation was added
1 parentbcafa26 commit3acc4ac

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

‎src/backend/executor/execMain.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@
4747
#include"commands/trigger.h"
4848
#include"executor/execdebug.h"
4949
#include"foreign/fdwapi.h"
50-
#include"jit/jit.h"
5150
#include"mb/pg_wchar.h"
5251
#include"miscadmin.h"
5352
#include"optimizer/clauses.h"
@@ -498,10 +497,6 @@ standard_ExecutorEnd(QueryDesc *queryDesc)
498497
UnregisterSnapshot(estate->es_snapshot);
499498
UnregisterSnapshot(estate->es_crosscheck_snapshot);
500499

501-
/* release JIT context, if allocated */
502-
if (estate->es_jit)
503-
jit_release_context(estate->es_jit);
504-
505500
/*
506501
* Must switch out of context before destroying it
507502
*/

‎src/backend/executor/execUtils.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include"access/relscan.h"
4646
#include"access/transam.h"
4747
#include"executor/executor.h"
48+
#include"jit/jit.h"
4849
#include"mb/pg_wchar.h"
4950
#include"nodes/nodeFuncs.h"
5051
#include"parser/parsetree.h"
@@ -174,11 +175,11 @@ CreateExecutorState(void)
174175
*
175176
*Release an EState along with all remaining working storage.
176177
*
177-
* Note: this is not responsible for releasing non-memory resources,
178-
*such asopen relations or buffer pins. But it will shut down any
179-
*still-activeExprContexts within the EState. That is sufficient
180-
* cleanup for situations where the EState has only been used for expression
181-
* evaluation, and not to run a complete Plan.
178+
* Note: this is not responsible for releasing non-memory resources, such as
179+
* open relations or buffer pins. But it will shut down any still-active
180+
* ExprContexts within the EState and deallocate associated JITed expressions.
181+
*That is sufficientcleanup for situations where the EState has only been
182+
*used for expressionevaluation, and not to run a complete Plan.
182183
*
183184
* This can be called in any memory context ... so long as it's not one
184185
* of the ones to be freed.
@@ -204,6 +205,13 @@ FreeExecutorState(EState *estate)
204205
/* FreeExprContext removed the list link for us */
205206
}
206207

208+
/* release JIT context, if allocated */
209+
if (estate->es_jit)
210+
{
211+
jit_release_context(estate->es_jit);
212+
estate->es_jit=NULL;
213+
}
214+
207215
/*
208216
* Free the per-query memory context, thereby releasing all working
209217
* memory, including the EState node itself.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp