Skip to content

Commit 8e96082

Browse files
JITServer: handle non-null compilation
When a JITServer stream failure is thrown, sometimes setting the compilation object to NULL can be skipped to head straight into exception handling. This causes an assert to be tripped. In this particular case, there is a front-end call in outOfProcessCompilationEnd (within computeDataForCHTableCommit) which can cause a stream error. Since it isn't guarded by a global try-catch, it results in the given assert being tripped. Addresses this issue: #23845
1 parent 3c076ab commit 8e96082

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

runtime/compiler/control/CompilationThread.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9426,6 +9426,20 @@ TR_MethodMetaData *TR::CompilationInfoPerThreadBase::compile(J9VMThread *vmThrea
94269426
optimizationPlan);
94279427

94289428
TRIGGER_J9HOOK_JIT_COMPILING_END(_jitConfig->hookInterface, vmThread, method);
9429+
9430+
if (_compiler && _methodBeingCompiled->isOutOfProcessCompReq()) {
9431+
// In JITServer mode preemtively call _compiler->retainedMethods() to
9432+
// create the retainedMethod set if it doesn't exist. If this operation
9433+
// is not done now, it will be done later during:
9434+
// postCompilationTasks
9435+
// - compilationEnd
9436+
// - outOfProcessCompilationEnd
9437+
// - computeDataForCHTableCommit
9438+
// - getDataForClient
9439+
// The server will send a message to the client, which could cause an
9440+
// exception and exceptions are not allowed to be triggerred from postCompilationTasks()
9441+
_compiler->retainedMethods();
9442+
}
94299443
} catch (const std::exception &e) {
94309444
const char *exceptionName;
94319445

runtime/compiler/control/JITServerCompilationThread.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ void outOfProcessCompilationEnd(TR_MethodToBeCompiled *entry, TR::Compilation *c
173173

174174
auto clientData = comp->getClientData();
175175
bool aotCacheStore = comp->isAOTCacheStore();
176-
bool useServerOffsets = aotCacheStore && clientData->useServerOffsets(entry->_stream);
176+
bool useServerOffsets = aotCacheStore & clientData->useServerOffsets(entry->_stream);
177177
const CachedAOTMethod *methodRecord = NULL;
178178

179179
if (compInfoPT->isAOTCacheStore()) {

runtime/compiler/env/J9RetainedMethodSet.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,6 +583,8 @@ void J9::RepeatRetainedMethodsAnalysis::getDataForClient(TR::Compilation *comp,
583583
}
584584

585585
TR_ResolvedMethod *keepaliveMethod = NULL;
586+
// retainedMethods is guaranteed to exist, so no messages
587+
// will be sent to the server. See issue #23845
586588
auto keepaliveMethodsIter = comp->retainedMethods()->keepaliveMethods();
587589
while (keepaliveMethodsIter.next(&keepaliveMethod)) {
588590
keepaliveMethods.push_back(static_cast<TR_ResolvedJ9JITServerMethod *>(keepaliveMethod)->getRemoteMirror());

0 commit comments

Comments
 (0)