2011-05-18, 21:32
Jason, found an issue with an open thread. Haven't been able to isolate it yet. To reproduce, exit PseudoTV using the Esc key method. It throws the exception and logs the issue with not the last thread. Exiting using the X key doesn't leave an open thread. Hopefully that will help narrow down where the issue is. Can anyone else reproduce this issue?
msg: Fatal Python error: Py_EndInterpreter: not the last thread
Update: Figured it out. After it exits you have to wait for the thread to exit completely and give back control to XBMC. If you exit and then close XBMC right away, the thread doesn't have time to finish exiting.
Update #2: Thought I figured it out, but I haven't. It is still giving me the exception even if I wait for control to return. I added the threading.enumerate() to output the remaining thread at the end of the end function and at the end of the onAction function after the self.actionSemaphore.release(). Here is the log.
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-TVOverlay: [<_MainThread(MainThread, started)>]
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-TVOverlay: onAction return
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-TVOverlay: [<_MainThread(MainThread, started)>]
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-Player: Playback stopped
18:27:35 T:4624 M:2148200448 DEBUG: script.pseudotv-TVOverlay: __init__ return
18:27:38 T:4624 M:2152443904 INFO: msg: Fatal Python error: Py_EndInterpreter: not the last thread
So based on the threading log output it's not an open timer thread or open channelListThread. Why is it throwing the error if only the MainThread is still open. Shouldn't python clean this up?
msg: Fatal Python error: Py_EndInterpreter: not the last thread
Update: Figured it out. After it exits you have to wait for the thread to exit completely and give back control to XBMC. If you exit and then close XBMC right away, the thread doesn't have time to finish exiting.
Update #2: Thought I figured it out, but I haven't. It is still giving me the exception even if I wait for control to return. I added the threading.enumerate() to output the remaining thread at the end of the end function and at the end of the onAction function after the self.actionSemaphore.release(). Here is the log.
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-TVOverlay: [<_MainThread(MainThread, started)>]
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-TVOverlay: onAction return
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-TVOverlay: [<_MainThread(MainThread, started)>]
18:27:35 T:4624 M:2148204544 DEBUG: script.pseudotv-Player: Playback stopped
18:27:35 T:4624 M:2148200448 DEBUG: script.pseudotv-TVOverlay: __init__ return
18:27:38 T:4624 M:2152443904 INFO: msg: Fatal Python error: Py_EndInterpreter: not the last thread
So based on the threading log output it's not an open timer thread or open channelListThread. Why is it throwing the error if only the MainThread is still open. Shouldn't python clean this up?