Opened 22 months ago

#13092 new Bug Report - Crash

Python BEConnection:backendCommand timeout too low and improper protocol implementation

Reported by: angela.schmid@… Owned by: Raymond Wagner
Priority: minor Milestone: needs_triage
Component: Bindings - Python Version: 0.28.1
Severity: medium Keywords: python backendcommand timeout
Cc: Ticket locked: no

Description

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''

Change History (0)

Note: See TracTickets for help on using tickets.