matshow plot segfault; seems gc related
- 主要語言
- Julia
- 星號
- 488
- 分支
- 90
- PR 合併指標
- 30 天內沒有已合併 PR
描述
Systems: Ubuntu 14.10 and OSX
Libs: IJulia, PyCall, PyPlot all even with master
``` julia
using PyPlot
matshow(rand(10, 10))
```
works from the Julia REPL but segfaults intermittently in the notebook. That is to say, it sometimes works once on recompilation of cache files but fails thereafter.
Here's the error output:
```
signal (11): Segmentation fault
_PyObject_GenericGetAttrWithDict at -------src-dir-------/Python-2.7.10/Objects/object.c:1430
PyEval_EvalFrameEx at -------src-dir-------/Python-2.7.10/Python/ceval.c:2272
PyEval_EvalCodeEx at -------src-dir-------/Python-2.7.10/Python/ceval.c:3267
function_call at -------src-dir-------/Python-2.7.10/Objects/funcobject.c:533
PyObject_Call at -------src-dir-------/Python-2.7.10/Objects/abstract.c:2529
ext_do_call at -------src-dir-------/Python-2.7.10/Python/ceval.c:4348
PyEval_EvalCodeEx at -------src-dir-------/Python-2.7.10/Python/ceval.c:3267
fast_function at -------src-dir-------/Python-2.7.10/Python/ceval.c:4131
PyEval_EvalCodeEx at -------src-dir-------/Python-2.7.10/Python/ceval.c:3267
function_call at -------src-dir-------/Python-2.7.10/Objects/funcobject.c:536
PyObject_Call at -------src-dir-------/Python-2.7.10/Objects/abstract.c:2529
instancemethod_call at -------src-dir-------/Python-2.7.10/Objects/classobject.c:2603
PyObject_Call at -------src-dir-------/Python-2.7.10/Objects/abstract.c:2529
do_call at -------src-dir-------/Python-2.7.10/Python/ceval.c:4253
PyEval_EvalCodeEx at -------src-dir-------/Python-2.7.10/Python/ceval.c:3267
function_call at -------src-dir-------/Python-2.7.10/Objects/funcobject.c:533
PyObject_Call at -------src-dir-------/Python-2.7.10/Objects/abstract.c:2529
ext_do_call at -------src-dir-------/Python-2.7.10/Python/ceval.c:4348
PyEval_EvalCodeEx at -------src-dir-------/Python-2.7.10/Python/ceval.c:3267
function_call at -------src-dir-------/Python-2.7.10/Objects/funcobject.c:533
PyObject_Call at -------src-dir-------/Python-2.7.10/Objects/abstract.c:2529
instancemethod_call at -------src-dir-------/Python-2.7.10/Objects/classobject.c:2603
PyObject_Call at -------src-dir-------/Python-2.7.10/Objects/abstract.c:2529
pycall at /home/pearson/.julia/v0.4/PyCall/src/exception.jl:78
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1a7958)
jl_apply_generic at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_f_apply at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
julia_pycall_22349 at (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_f_kwcall at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_f_apply at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
call at /home/pearson/.julia/v0.4/PyCall/src/PyCall.jl:407
julia_call_22347 at (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_f_kwcall at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
writemime at /home/pearson/.julia/v0.4/PyPlot/src/PyPlot.jl:309
jlcall_writemime_22346 at (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1a7958)
jl_apply_generic at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_f_apply at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
base64encode at base64.jl:160
display_dict at /home/pearson/.julia/v0.4/IJulia/src/execute_request.jl:32
display at /home/pearson/.julia/v0.4/IJulia/src/inline.jl:35
jlcall_display_22304 at (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1a7958)
jl_apply_generic at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
display at multimedia.jl:151
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1a7958)
jl_apply_generic at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
display at /home/pearson/.julia/v0.4/IJulia/src/inline.jl:56
execute_request_0x535c5df2 at /home/pearson/.julia/v0.4/IJulia/src/execute_request.jl:204
jlcall_execute_request_0x535c5df2_21705 at (unknown line)
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b1a7958)
jl_apply_generic at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
eventloop at /home/pearson/.julia/v0.4/IJulia/src/IJulia.jl:130
unknown function (ip: 0x7f846b1a7958)
jl_apply_generic at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
anonymous at task.jl:448
unknown function (ip: 0x7f846b1b48b6)
jl_trampoline at /home/pearson/code/julia/usr/bin/../lib/libjulia-debug.so (unknown line)
unknown function (ip: 0x7f846b251fae)
unknown function (ip: 0x7f846b2526d4)
unknown function (ip: (nil))
```
Note that some other plots work just fine, and matshow works after some other plots. For instance
``` julia
using PyPlot
plot(rand(100))
matshow(rand(10, 10))
```
returns (in the notebook) the first plot, followed by
```
PyError (:PyObject_Call)
AttributeError("'Axes' object has no attribute '_animated'",)
File "/home/pearson/anaconda/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2158, in print_figure
**kwargs)
File "/home/pearson/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 521, in print_png
FigureCanvasAgg.draw(self)
File "/home/pearson/anaconda/lib/python2.7/site-packages/matplotlib/backends/backend_agg.py", line 469, in draw
self.figure.draw(self.renderer)
File "/home/pearson/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 59, in draw_wrapper
draw(artist, renderer, *args, **kwargs)
File "/home/pearson/anaconda/lib/python2.7/site-packages/matplotlib/figure.py", line 1082, in draw
dsu = [row for row in dsu if not row[1].get_animated()]
File "/home/pearson/anaconda/lib/python2.7/site-packages/matplotlib/artist.py", line 627, in get_animated
return self._animated
[inlined code] from /home/pearson/.julia/v0.4/PyCall/src/exception.jl:82
in pycall at /home/pearson/.julia/v0.4/PyCall/src/PyCall.jl:387
in call at /home/pearson/.julia/v0.4/PyCall/src/PyCall.jl:414
in writemime at /home/pearson/.julia/v0.4/PyPlot/src/PyPlot.jl:310
in base64encode at base64.jl:160
in display_dict at /home/pearson/.julia/v0.4/IJulia/src/execute_request.jl:32
in display at /home/pearson/.julia/v0.4/IJulia/src/inline.jl:35
[inlined code] from multimedia.jl:151
in display at multimedia.jl:162
in display at /home/pearson/.julia/v0.4/IJulia/src/inline.jl:56
```
Putting the two plot calls in different cells works just fine.
**Important**: This error goes away if I remove the `finalizer` from `PyObject`, which is why I suspect it's gc-related. I've spent more time than I'd like to admit working on this, so I figured I report it.
貢獻指南
這個儲存庫沒有索引到貢獻指南
研究方向
Reproduce the notebook failure with PyPlot's matshow calls, then inspect PyPlot/src/PyPlot.jl around writemime and PyCall/src/PyCall.jl around PyObject and its finalizer. Compare the behavior with the finalizer removed; done means consecutive plot calls render without the AttributeError or segmentation fault.
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- julia, matplotlib, python
- 領域
- data-visualization
- Issue 類型
- 缺陷
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100