Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Random Crash on OSX when using Thread #2857

Closed
tito opened this issue Jan 15, 2015 · 1 comment
Closed

Random Crash on OSX when using Thread #2857

tito opened this issue Jan 15, 2015 · 1 comment
Assignees
Labels
Component: core-providers kivy/core Component: graphics kivy/graphics Priority: High Should be fixed ASAP Status: Confirmed Confirmed as real issue
Milestone

Comments

@tito
Copy link
Member

tito commented Jan 15, 2015

On IRC, one user have few crash: the GC is triggered in a thread, and tries to deallocate a Shader. The Shader is the only instructions that are deallocated directly, it should be fixed the same way as others (texture, fbo, etc.)

Process:               Python [1255]
Path:                  /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            org.python.python
Version:               2.7.6 (2.7.6)
Build Info:            python-89000000000000~7
Code Type:             X86-64 (Native)
Parent Process:        pycharm [367]
Responsible:           pycharm [367]
User ID:               501

PlugIn Path:             /Applications/Kivy.app/Contents/Resources/kivy/kivy/graphics/context.so
PlugIn Identifier:       context.so
PlugIn Version:          ??? (???)

...

Thread 7 Crashed:
0   libsystem_kernel.dylib              0x00007fff8825d282 __pthread_kill + 10
1   libsystem_c.dylib                   0x00007fff8b3d1b73 abort + 129
2   org.python.python                   0x0000000105a3fa57 Py_FatalError + 49
3   libsystem_platform.dylib            0x00007fff88491f1a _sigtramp + 26
4   org.python.python                   0x0000000105a20f74 PyEval_EvalCodeEx + 1943
5   context.so                          0x0000000106bfe3a1 __pyx_f_4kivy_8graphics_7context_7Context_dealloc_shader + 41
6   shader.so                           0x0000000106123606 __pyx_tp_dealloc_4kivy_8graphics_6shader_Shader + 71
7   instructions.so                     0x000000010608d3d0 __pyx_tp_clear_4kivy_8graphics_12instructions_RenderContext + 64
8   org.python.python                   0x0000000105a52692 PyGC_Collect + 1610
9   org.python.python                   0x0000000105a52ab1 _PyObject_GC_Malloc + 213
10  org.python.python                   0x00000001059e95e5 PyType_GenericAlloc + 56
11  org.python.python                   0x00000001059baaba _PyExc_Init + 5038
12  org.python.python                   0x00000001059e9c77 _PyType_Lookup + 1254
...
88  org.python.python                   0x0000000105a26d6b PyEval_CallObjectWithKeywords + 93
89  org.python.python                   0x0000000105a53882 initthread + 1526
90  libsystem_pthread.dylib             0x00007fff922f02fc _pthread_body + 131
91  libsystem_pthread.dylib             0x00007fff922f0279 _pthread_start + 176
92  libsystem_pthread.dylib             0x00007fff922ee4b1 thread_start + 13

References: http://pastebin.com/0rwww4gH and http://pastebin.com/qwzFAp0r

@tito tito added Component: graphics kivy/graphics Component: core-providers kivy/core Priority: High Should be fixed ASAP Status: Confirmed Confirmed as real issue labels Jan 15, 2015
@tito tito added this to the 1.9.0 milestone Jan 15, 2015
@Kovak
Copy link
Contributor

Kovak commented Jan 15, 2015

Looking into this further:

We do seem to 'queue' the shader deallocation just like texture/fbo.

In shader.pyx line 127

    def __dealloc__(self):
        if self.shader != -1:
            get_context().dealloc_shader_source(self.shader)

which call

context.pyx 102

    cdef void dealloc_shader_source(self, int shader):
        cdef array arr
        if shader == -1:
            return
        arr = self.lr_shadersource
        arr.append(shader)
        self.trigger_gl_dealloc()

Which clock schedule the actual cleanup. Same as texture/fbo. It seems shader was brought in line as part of fixing #955 : 1409396

@tito tito self-assigned this Jan 18, 2015
@tito tito closed this as completed in 7560027 Jan 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: core-providers kivy/core Component: graphics kivy/graphics Priority: High Should be fixed ASAP Status: Confirmed Confirmed as real issue
Projects
None yet
Development

No branches or pull requests

2 participants