运行带有Python 3.7.3的Ubuntu仿生的Docker容器中的Python代码抛出munmap_chunk():无效的指针(),我使用内存分析来监视已使用的内存量,最大为160MB,Docker容器具有1024MB分配给它。
尝试将Numpy降级到1.12.0,然后又降到1.16.4,没有任何效果。
通过GDB,我收到了以下回溯,这些回溯指向源代码中的numpy免费缓存片段。指向
Numpy的相关源代码 https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/alloc.c 264,104(称为取消分配)
https://github.com/numpy/numpy/blob/master/numpy/core/src/multiarray/arrayobject.c 533、520个免费缓存操作
Error message:
Thread 1 "python3.7" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
51 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) backtrace
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007ffff7a24801 in __GI_abort () at abort.c:79
#2 0x00007ffff7a6d897 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff7b9ab9a "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007ffff7a7490a in malloc_printerr (str=str@entry=0x7ffff7b9c7a8 "munmap_chunk(): invalid pointer") at malloc.c:5350
#4 0x00007ffff7a7becc in munmap_chunk (p=0x1737a90) at malloc.c:2846
#5 __GI___libc_free (mem=0x1737aa0) at malloc.c:3117
#6 0x00007ffff64b3ecc in PyDataMem_FREE (ptr=0x1737aa0) at numpy/core/src/multiarray/alloc.c:264
#7 _npy_free_cache (dealloc=0x7ffff64b4130 <PyDataMem_FREE>, cache=0x7ffff6a292a0 , msz=1024, nelem=, p=0x1737aa0) at numpy/core/src/multiarray/alloc.c:104
#8 npy_free_cache (p=0x1737aa0, sz=) at numpy/core/src/multiarray/alloc.c:139
#9 0x00007ffff64b7627 in array_dealloc (self=0x7fffdee1ab70) at numpy/core/src/multiarray/arrayobject.c:533
#10 0x00007ffff64b7747 in array_dealloc (self=0x7fffdee1a3a0) at numpy/core/src/multiarray/arrayobject.c:520
#11 0x000000000056aa70 in ?? ()
#12 0x000000000056a5ca in ?? ()
#13 0x000000000056aa70 in ?? ()
#14 0x000000000058decd in _PyObject_GenericSetAttrWithDict ()
#15 0x00000000005435db in ?? ()
#16 0x00000000004d0336 in ?? ()
#17 0x00000000005b1d2b in _PyObject_FastCallKeywords ()
#18 0x00000000005cc8f1 in ?? ()
#19 0x000000000051add9 in _PyEval_EvalFrameDefault ()
#20 0x00000000005b2257 in _PyFunction_FastCallDict ()
#21 0x0000000000541053 in ?? ()
#22 0x00000000005a409b in PyObject_SetAttr ()
#23 0x000000000051710d in _PyEval_EvalFrameDefault ()
#24 0x00000000005cd202 in _PyEval_EvalCodeWithName ()
#25 0x00000000005b11a2 in _PyFunction_FastCallKeywords ()
#26 0x0000000000516b9a in _PyEval_EvalFrameDefault ()
#27 0x00000000005b0eac in _PyFunction_FastCallKeywords ()
#28 0x00000000005cc6ea in ?? ()
#29 0x000000000051add9 in _PyEval_EvalFrameDefault ()
#30 0x00000000005cd202 in _PyEval_EvalCodeWithName ()
#31 0x00000000005b11a2 in _PyFunction_FastCallKeywords ()
#32 0x00000000005cc6ea in ?? ()
#33 0x000000000051add9 in _PyEval_EvalFrameDefault ()
#34 0x00000000005cd202 in _PyEval_EvalCodeWithName ()
#35 0x00000000005b2437 in _PyFunction_FastCallDict ()
#36 0x00000000005425b3 in ?? ()
#37 0x000000000056acb1 in ?? ()
#38 0x00000000005b4266 in PyObject_Call ()
#39 0x0000000000518041 in _PyEval_EvalFrameDefault ()
#40 0x00000000005cd202 in _PyEval_EvalCodeWithName ()
#41 0x00000000005b2437 in _PyFunction_FastCallDict ()
#42 0x0000000000518041 in _PyEval_EvalFrameDefault ()
#43 0x00000000005cd202 in _PyEval_EvalCodeWithName ()
#44 0x00000000005b11a2 in _PyFunction_FastCallKeywords ()
#45 0x00000000005cc6ea in ?? ()
#46 0x0000000000517a9e in _PyEval_EvalFrameDefault ()
#47 0x00000000005cd202 in _PyEval_EvalCodeWithName ()
#48 0x00000000005b11a2 in _PyFunction_FastCallKeywords ()
#49 0x00000000005cc6ea in ?? ()
#50 0x0000000000517a9e in _PyEval_EvalFrameDefault ()
#51 0x00000000005b0eac in _PyFunction_FastCallKeywords ()
#52 0x0000000000516b9a in _PyEval_EvalFrameDefault ()
#53 0x00000000005cd202 in _PyEval_EvalCodeWithName ()
#54 0x0000000000516673 in PyEval_EvalCode ()
#55 0x0000000000629bb2 in ?? ()
#56 0x0000000000629c6a in PyRun_FileExFlags ()
#57 0x000000000062a950 in PyRun_SimpleFileExFlags ()
#58 0x00000000006569c5 in ?? ()
#59 0x0000000000656d2e in _Py_UnixMain ()
#60 0x00007ffff7a05b97 in __libc_start_main (main=0x4c0450
, argc=3, argv=0x7fffffff1c58, init=, fini=, rtld_fini=, stack_end=0x7fffffff1c48) at ../csu/libc-start.c:310
#61 0x00000000005e864a in _start ()
Numpy / Python版本信息: PYTHON:3.7.3 numpy的:1.16.4
来自拉伸发行版库的更详细的跟踪