[mythtv-commits] Ticket #13092: Python BEConnection:backendCommand timeout too low and improper protocol implementation

MythTV noreply at mythtv.org
Sun Aug 6 20:07:23 UTC 2017


#13092: Python BEConnection:backendCommand timeout too low and improper protocol
implementation
-------------------------------+-------------------------------------------
     Reporter:                 |      Owner:  wagnerrp
  angela.schmid@…              |
         Type:  Bug Report -   |     Status:  new
  Crash                        |
     Priority:  minor          |  Milestone:  needs_triage
    Component:  Bindings -     |    Version:  0.28.1
  Python                       |
     Severity:  medium         |   Keywords:  python backendcommand timeout
Ticket locked:  0              |
-------------------------------+-------------------------------------------
 I use lossless_cut to export recordings to the video library which half of
 the time crashed:

 CRITICAL - Export to MythVideo, aborting script.
            Error: invalid literal for int() with base 10: ''

 The problem occurs only when the video disk had to spin up.

 The root cause is a too low timeout of 10 seconds in the Python
 BEConnection class when calling QUERY_FILE_EXISTS.

 I could identify the following problems:

 {{{
 lossless_cut
 which calls dataheap.py Video:open()
 which calls mythproto.py ftopen(), can not provide a timeout, because the
 logic to use a backend is in the next method
 which calls mythproto.py, path = FileOps(host, db=db).fileExists(filename,
 sgroup)
 which calls mythproto.py backendCommand(), fileExists calls backendCommand
 and should provide a higher timeout.
 which calls connections.py BEConnection:backendCommand(), with default
 timeout=10seconds
 }}}

 - A user application can not provide a higher timeout.
 - fileExists calls backendCommand and should provide a higher timeout.
 - BEConnection:backendCommand() should use a higher default timeout.


 The exception is misleading and caused by *not* throwing a proper
 exception, when hit by a timeout:

 {{{
 BEConnection.backendCommand:
     if len(select([self.socket],[],[], timeout)[0]) == 0:
        # no data, return
        return u''
 }}}

 - The client application receives an empty string, instead of a response
 described in
 [https://www.mythtv.org/wiki/QUERY_FILE_EXISTS_(Myth_Protocol)] or an
 exception.
 - "no data, return empty string", is there really such a response from the
 backend in the Myth protocol?

--
Ticket URL: <https://code.mythtv.org/trac/ticket/13092>
MythTV <http://www.mythtv.org>
MythTV Media Center


More information about the mythtv-commits mailing list