Fatal Python error: none_dealloc: deallocating None: bug likely caused by a refcount error in a C extension

huangapple go评论73阅读模式
英文:

Fatal Python error: none_dealloc: deallocating None: bug likely caused by a refcount error in a C extension

问题

The problem you're encountering appears to be related to a Python runtime error after upgrading to Python 3.11.3. It seems to be a bug that could be caused by a reference count error in a C extension. This issue didn't occur when you were using Python 3.9.

问题似乎与升级到Python 3.11.3后出现的Python运行时错误有关。这似乎是由C扩展中的引用计数错误引起的 bug。在使用Python 3.9时,这个问题没有出现。

英文:

I'm running a script with this version of python:
> Python 3.11.3 (main, May 2 2023, 23:12:30) [GCC 9.4.0] on linux

The script uses these imports:

import datetime
import time
import mysql.connector
import traceback
import tracemalloc
import logging
import sys

After a while it crashes with this output:

Fatal Python error: none_dealloc: deallocating None: bug likely caused by a refcount error in a C extension
Python runtime state: initialized

Current thread 0x00007fa201272280 (most recent call first):
  File "/home/user/main.py", line 119 in <module>

Extension modules: _mysql_connector (total: 1)
Aborted (core dumped)

What could the problem be? It worked find with python3.9 but I had to upgrade python (by compiling it from source) and now I have this error on every .py I run.

答案1

得分: 1

我正在寻找相同问题的解决方案。
运行脚本几分钟后,它会释放空值。
在PyCharm上运行时,问题比在Linux终端上更快地发生。

查看您的代码后,我意识到唯一的相似之处是MySQL连接器库。也许问题就在那里。我会降级并查看问题是否仍然存在。我建议您也这样做。

英文:

I'm searching for the solution of the same problem.
After some minutes running my script it gets deallocating None.
When running on pycharm the problem occurs faster then in linux terminal.

Looking to your code i realize that the only similarity is the mysql connector library. maybe the problem is there. i'll do a downgrade and see if the problem persists. I recommend you to do the same.

答案2

得分: 0

我遇到了相同的问题。明确是mysql.connector。我所做的是在每个第10个批次中使用pool_reset_session=True,现在它正常运行。不能一直使用,否则会减慢并停止,但在每个第10个批次上,性能变化不明显,也不再崩溃。

英文:

I had the same issue. definitely mysql.connector. what I did is I used pool_reset_session=True in every 10th batch, now it works fine. can't use it all the time, then it slows down and stops, but on every 10th no noticeable performance change and no more crashes.

huangapple
  • 本文由 发表于 2023年5月7日 18:46:08
  • 转载请务必保留本文链接:https://go.coder-hub.com/76193436.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定