Opened 7 years ago
Closed 3 years ago
#13092 closed Bug Report - Crash (Trac EOL)
Python BEConnection:backendCommand timeout too low and improper protocol implementation
Reported by: | 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''
- 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?
Note: See
TracTickets for help on using
tickets.
We have moved all bug tracking to github [1]
If you continue to have this issue, please open a new issue at github, referencing this ticket.
[1] - https://github.com/MythTV/mythtv/issues