This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: GCState *gcstate = get_gc_state() gives fatal error in Python 3.10.2
Type: crash Stage: resolved
Components: C API Versions: Python 3.10
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: christian.heimes, eaqrzn, eric.smith
Priority: normal Keywords:

Created on 2021-12-13 09:22 by eaqrzn, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (8)
msg408431 - (view) Author: Ajaya Sutar (eaqrzn) Date: 2021-12-13 09:22
+++ General Fault Exception
+++ Invalid read from 0000000000000000
    rsp:       74b27f8a10, rip:     7ffe704e2f93, rbp:       74b27f8ce9
    rsi:                0, rdi:                0
    rax:                0, rbx:               7f, rcx:      194b6e90000, rdx:      194b6e90000
    r8:       194b6db96c0, r9:                 1, r10:             8000, r11:       74b27f8a00
    r12:                0, r13:                0, r14:      19484550e40, r15:                0
[ 1] 7FFE704E2F93 pylifecycle\fatal_output_debug Line 2492 +0x43               (python310) 
[ 2] 7FFE704E3CCA pylifecycle\fatal_error Line 2734 +0x2ba                     (python310) 
[ 3] 7FFE704E3E4C pylifecycle\_Py_FatalErrorFormat Line 2784 +0xec             (python310) 
[ 4] 7FFE704E6F52 pystate\PyThreadState_Delete Line 930 +0x52                  (python310) 
[ 5] 7FFE704E1BF9 pylifecycle\new_interpreter Line 1967 +0x269                 (python310) 
[ 6] 7FFE704E1CDF pylifecycle\Py_NewInterpreter Line 1988 +0x1f                (python310)
msg408432 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2021-12-13 09:38
Please show the code that causes this problem. There’s not enough information here to reproduce this failure.
msg408442 - (view) Author: Ajaya Sutar (eaqrzn) Date: 2021-12-13 11:05
It is a simply python script. Even if you will run a simply python script without any content that is giving error. Just for example journal.py if we run it is also giving error. In python 3.8, we are able to create // create sub-interpreter using Py_NewInterpreter  and it is working fine. but in python 3.10.1 it is not working fine. it is giving fatal error.
msg408444 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2021-12-13 11:21
We cannot help you unless you show us your code and provide a reproducer.
msg414441 - (view) Author: Ajaya Sutar (eaqrzn) Date: 2022-03-03 14:17
I was running one python script. At the time of python exit while calling Py_XDECREF(weakRefObject), it is calling giving exception in python 3.10.2. 

While debugging found  

In python 3.8.12, it is working fine with _PyRuntime.

void
PyObject_GC_Del(void *op)
{
    PyGC_Head *g = AS_GC(op);
    if (_PyObject_GC_IS_TRACKED(op)) {
        gc_list_remove(g);
    }
    struct _gc_runtime_state *state = &_PyRuntime.gc;
    if (state->generations[0].count > 0) {
        state->generations[0].count--;
    }
    PyObject_FREE(g);
}

But in Python 3.10.2 it is not working with get_gc_state() giving exception. It seems it is memory issues. 

void
PyObject_GC_Del(void *op)
{
    PyGC_Head *g = AS_GC(op);
    if (_PyObject_GC_IS_TRACKED(op)) {
        gc_list_remove(g);
    }
    GCState *gcstate = get_gc_state();
    if (gcstate->generations[0].count > 0) {
        gcstate->generations[0].count--;
    }
    PyObject_Free(g);
}

Could you please check this issue.
Is there any fix or any workaround for it. Because so many python script are failing at the exit of python interpreter.

Thanks in advance
msg414442 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2022-03-03 14:23
> I was running one python script

Again: you need to show us the script that's causing this problem. I (and millions of others) run scripts all the time which do not fail in the way you describe. Unless you show us a script that causes the problem, we cannot help you.
msg414452 - (view) Author: Ajaya Sutar (eaqrzn) Date: 2022-03-03 15:49
Actually we can not share code due to certain term and conditions. 

Thanks.
msg414453 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2022-03-03 15:52
I understand. Then I'm going to close this issue, since there's nothing we can do.
History
Date User Action Args
2022-04-11 14:59:53adminsetgithub: 90219
2022-03-03 15:52:29eric.smithsetstatus: open -> closed
resolution: rejected
messages: + msg414453

stage: resolved
2022-03-03 15:49:28eaqrznsetmessages: + msg414452
2022-03-03 14:23:43eric.smithsetmessages: + msg414442
2022-03-03 14:17:34eaqrznsetstatus: pending -> open

messages: + msg414441
title: Journal execution gives fatal error in Python 3.10.1 -> GCState *gcstate = get_gc_state() gives fatal error in Python 3.10.2
2021-12-13 11:55:25eric.smithsetstatus: open -> pending
2021-12-13 11:21:48christian.heimessetnosy: + christian.heimes
messages: + msg408444
2021-12-13 11:05:19eaqrznsetmessages: + msg408442
2021-12-13 09:38:54eric.smithsetnosy: + eric.smith
messages: + msg408432
2021-12-13 09:22:21eaqrzncreate