File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 59
59
import com .oracle .graal .python .builtins .objects .function .PArguments ;
60
60
import com .oracle .graal .python .builtins .objects .function .Signature ;
61
61
import com .oracle .graal .python .nodes .PRootNode ;
62
- import com .oracle .graal .python .nodes .call .CallNode ;
63
62
import com .oracle .graal .python .nodes .call .CallDispatchers ;
63
+ import com .oracle .graal .python .nodes .call .CallNode ;
64
64
import com .oracle .graal .python .nodes .frame .ReadCallerFrameNode ;
65
65
import com .oracle .graal .python .runtime .ExecutionContext .CalleeContext ;
66
66
import com .oracle .graal .python .runtime .exception .ExceptionUtils ;
@@ -388,15 +388,23 @@ protected void perform(ThreadLocalAction.Access access) {
388
388
}
389
389
}
390
390
});
391
- } else if (gilOwner != lastGilOwner ) {
391
+ } else if (gilOwner != lastGilOwner && gilOwner . isAlive () ) {
392
392
/*
393
393
* If the gil changed owner since the last time we observed it, clear the
394
394
* flag to make sure we don't get stuck if the last owner exits before
395
395
* executing the safepoint.
396
396
*/
397
397
gilReleaseRequested = false ;
398
398
}
399
- lastGilOwner = gilOwner ;
399
+ if (gilOwner .isAlive ()) {
400
+ lastGilOwner = gilOwner ;
401
+ } else {
402
+ /*
403
+ * we should only store the thread if the thread is still alive, otherwise,
404
+ * we will be referring to an object that should have been collected.
405
+ */
406
+ lastGilOwner = null ;
407
+ }
400
408
}
401
409
}
402
410
}
You can’t perform that action at this time.
0 commit comments