[mythtv-users] ExternalRecorder - Errno 11

Stephen Worthington stephen_agent at jsw.gen.nz
Wed Nov 22 07:11:22 UTC 2017


On Wed, 22 Nov 2017 06:03:31 +0000, you wrote:

>Hi Everyone,
>
>I've been working on an external recorder for a while. It works most of the
>time, but recently i've been getting new errors.
>
>First, the sequence of calls for a successful play look like this:
>StartStreaming
>StopStreaming
>StartStreaming
>
>There's only a few milliseconds between the StopStreaming and the 2nd
>StartStreaming, so my code allows for it and that seems to work just
>fine... The StopStreaming in the logs below is probably a red herring.
>
>My problem below is that I am getting a "Resource temporarily unavailable
>(11)" when mythtv is trying to read from the stdin (the stdout of my
>program with the video stream)
>
>This seems to happen from this call:
>https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp#L125
>
>The STDIN stream is configured to be non blocking, so the errno 11 isn't
>unexpected:
>https://github.com/MythTV/mythtv/blob/master/mythtv/libs/libmythtv/recorders/ExternalStreamHandler.cpp#L343
>
>I am not sure what to change to keep this from happening.... it fails about
>50% of the time, which is annoying.
>
>I am looking for advice on a fix, or how to troubleshoot. I am running 0.29
>on Ubuntu 16.04.
>
>Thanks!
>Marc
>
>Trimmed logs from mythbackend:
>Nov 21 21:23:30  mythbackend: mythbackend[1286]: I TVRecEvent
>recorders/ExternalStreamHandler.cpp:1077 (ProcessCommand)
>ExternalRec(/home/recorder1/record.sh): ProcessCommand('Version?') =
>'OK:1.0'
>Nov 21 21:23:30 mythbackend: mythbackend[1286]: W TVRecEvent
>recorders/ExternalStreamHandler.cpp:1066 (ProcessCommand)
>ExternalRec(/home/recorder1/record.sh): External Recorder did not respond
>to 'StopStreaming'
>Nov 21 21:23:30  mythbackend: mythbackend[1286]: I TVRecEvent
>recorders/ExternalStreamHandler.cpp:1077 (ProcessCommand)
>ExternalRec(/home/recorder1/record.sh): ProcessCommand('StopStreaming') =
>'OK:Stopped'
>Nov 21 21:23:30  mythbackend: mythbackend[1286]: E TVRecEvent
>recorders/ExternalStreamHandler.cpp:130 (Read) Failed to read from External
>Recorder: #012#011#011#011eno: Resource temporarily unavailable (11)
>Nov 21 21:23:30 everest mythbackend: mythbackend[1286]: E TVRecEvent
>recorders/ExternalStreamHandler.cpp:151 (GetStatus) ExternIO::GetStatus:
>already in error state: 'Failed to read from External Recorder:
>#012#011#011#011eno: Resource temporarily unavailable (11)'
>Nov 21 21:23:30 mythbackend: mythbackend[1286]: I TVRecEvent
>recorders/ExternalStreamHandler.cpp:1014 (StopStreaming)
>ExternalRec(/home/recorder1/record.sh): Streaming stopped
>Nov 21 21:23:30  mythbackend: mythbackend[1286]: E ExternSH
>recorders/ExternalStreamHandler.cpp:625 (run)
>ExternalRec(/home/recorder1/record.sh): Failed to read from External
>Recorder: Failed to read from External Recorder: #012#011#011#011eno:
>Resource temporarily unavailable (11)

If I am reading the ExternalStreamHandler.cpp.ExternIO::Read function
correctly, then the only way that can happen is if your stdout stream
indicates that it has data buffered and available to be read (the
poll() call from the Ready() call says there is data there), but then
your stdout fails to provide that data when it is called from read().
The most obvious reason I can think of for that would be if your code
was slow in responding to the read(), due to some unforeseen
circumstance such as garbage collection or being swapped out at the
time.  But I would have thought that your stdout buffer would have
been there waiting to be read, rather than any higher code needing to
be run to provide the data.  Are you using buffered I/O on your
stdout?


More information about the mythtv-users mailing list