Django-程序因信号 SIGABRT 终止,中止

问题描述 投票:0回答:1

在我们的 django 项目中将 python 3.6 升级到 3.8 后,我们开始获取高达 500mb 的核心转储文件,这使得我们的 kubernetes pod 重新启动。没有日志,没有例外。

使用 gdB 调试核心转储文件后得到以下输出,

#Reading symbols from /usr/local/bin/uwsgi...
#[New LWP 8]
#[Thread debugging using libthread_db enabled]
#Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
#Core was generated by `uwsgi myapp.ini'.
#Program terminated with signal SIGABRT, Aborted.
#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#50    ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.

(gdb)回溯

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1  0x00007f5998445859 in __GI_abort () at abort.c:79
#2  0x00007f59984b026e in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7f59985da298 "%s\n")
    at ../sysdeps/posix/libc_fatal.c:155
#3  0x00007f59984b82fc in malloc_printerr (str=str@entry=0x7f59985d844d "corrupted size vs. prev_size")
    at malloc.c:5347
#4  0x00007f59984b896b in unlink_chunk (p=p@entry=0x55dc42df1900, av=0x7f599860fb80 <main_arena>) at malloc.c:1454
#5  0x00007f59984b9e8b in _int_free (av=0x7f599860fb80 <main_arena>, p=0x55dc42dedf40, have_lock=<optimized out>)
    at malloc.c:4342
#6  0x00007f5998857bde in ?? () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#7  0x00007f5998697070 in ?? () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#8  0x00007f599877b89d in _PyGC_CollectNoFail () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#9  0x00007f59987bcefd in PyImport_Cleanup () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#10 0x00007f59987a8610 in Py_FinalizeEx () from /lib/x86_64-linux-gnu/libpython3.8.so.1.0
#11 0x000055dc3f2943e1 in uwsgi_plugins_atexit ()
#12 0x00007f59984698a7 in __run_exit_handlers (status=30, listp=0x7f599860f718 <__exit_funcs>, 
    run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
#13 0x00007f5998469a60 in __GI_exit (status=<optimized out>) at exit.c:139
#14 0x000055dc3f249415 in uwsgi_exit ()
#15 0x000055dc3f292f2b in end_me ()
#16 0x000055dc3f2965f7 in uwsgi_ignition ()
#17 0x000055dc3f29ae16 in uwsgi_worker_run ()
#18 0x000055dc3f29b394 in uwsgi_run ()
#19 0x000055dc3f245d44 in main ()

无法追踪代码或Python包中的问题。

  1. python3.8
  2. djang2.1.5
  3. Ubuntu 20.04
c linux segmentation-fault sigabrt django-2.1
1个回答
0
投票

#3  0x00007f59984b82fc in malloc_printerr (str=str@entry=0x7f59985d844d "corrupted size vs. prev_size")

此错误意味着:GLIBC 检测到存在堆损坏(堆缓冲区溢出、在

free
d 后使用内存等)。

您应该在 Valgrind 下运行您的 Python 进程,这应该告诉您错误正在发生。如果没有专门的工具(例如 Valgrind),堆损坏错误是不可能调试的。

© www.soinside.com 2019 - 2024. All rights reserved.