[mythtv-users] Database damage?

Stephen Worthington stephen_agent at jsw.gen.nz
Sat Feb 13 16:12:57 UTC 2021

On Sat, 13 Feb 2021 07:47:07 -0500, you wrote:

>> On Feb 12, 2021, at 9:49 PM, Stephen Worthington <stephen_agent at jsw.gen.nz> wrote:
>> When you say find_orphans.py crashes, do you mean it gives you a
>> Python error message with a traceback?  If so, then please post that
>> and I can look at trying to fix it.
>Thanks for the offer.  Note that I’m still running 0.28-fixes and the backend and database are on Mac OS X.
>I did a lot of manual pruning yesterday and have the number of zero byte recordings down to 561:
>  [much elided
>  MediumMini.local: Wisdom of the Crowd - Root Directory                      1411_20180108005900.ts
>  MediumMini.local: Wisdom of the Crowd - The Tipping Point                   1411_20180115005900.ts
>  MediumMini.local: Young Sheldon - A Math Emergency and Perky Palms          1041_20190208013000.ts
>  MediumMini.local: Young Sheldon - A Loaf of Bread and a Grand Old Flag      1041_20190222013000.ts
>                                                                                  Count:         561
>Are you sure you want to continue?
>> yes
>Traceback (most recent call last):
>  File "/opt/local/share/mythtv/contrib/find_orphans.py", line 230, in <module>
>    main()
>  File "/opt/local/share/mythtv/contrib/find_orphans.py", line 214, in main
>    opt[1](opt[2])
>  File "/opt/local/share/mythtv/contrib/find_orphans.py", line 129, in delete_recs
>    rec.delete(True, True)
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/dataheap.py", line 365, in delete
>    return self.getProgram().delete(force, rerecord)
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/mythproto.py", line 964, in delete
>    be.forgetRecording(self)
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/mythproto.py", line 661, in forgetRecording
>    program.toString()]))
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/mythproto.py", line 155, in backendCommand
>    return self._conn.command.backendCommand(data)
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/connections.py", line 314, in backendCommand
>    self.reconnect(True)
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/connections.py", line 243, in reconnect
>    self.connect()
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/connections.py", line 224, in connect
>    self.socket.connect((self.host, self.port))
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/MythTV/utility/other.py", line 306, in connect
>    socket.socket.connect(self, *args, **kwargs)
>  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 228, in meth
>    return getattr(self._sock,name)(*args)
>socket.error: [Errno 61] Connection refused
>Note that the backend crashed.  The be log didn’t capture anything.  A subsequent run of find_orphans.py indicated there are now 560 zero-byte recordings.  I did not try to determine which one was removed!  ;)
>Following is some version info in case it helps:
>MediumMini:~ mytthtv$ python --version
>Python 2.7.10
>MediumMini:~ mytthtv$ port provides /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py
>/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py is provided by: python27
>MediumMini:~ mytthtv$ mythfrontend --version
>Please attach all output as a file in bug reports.
>MythTV Version : v0.28.1-e26a33c6-MacPorts
>MythTV Branch : fixes/0.28
>Network Protocol : 88
>Library API : 0.28.20161120-1
>QT Version : 5.8.0
>Options compiled in:
> release darwin_da using_corevideo using_backend using_bindings_perl using_bindings_python using_bindings_php using_darwin using_frontend using_hdhomerun using_vbox using_libcrypto using_libdns_sd using_libfftw3 using_libxml2 using_lirc using_mheg using_opengl using_opengl_video using_opengl_themepainter using_qtwebkit using_qtscript using_taglib using_appleremote using_bindings_perl using_bindings_python using_bindings_php using_darwin_da using_freetype2 using_mythtranscode using_opengl using_ffmpeg_threads using_mheg using_libass using_libxml2

The find_orphans.py error is just saying it has lost its connection to
the backend and was unable to reconnect.  So my best guess is that the
problem is in mythbackend and it crashing is the cause of the problem,
not anything in find_orphans.py.  However, the mythbackend crash is
likely triggered by deleting so many recordings at once - hopefully
something that will already have been fixed in later MythTV versions.
So a possible workaround would be to just add a delay of several
seconds after each time the rec.delete() call in line 129 of
find_orphans.py is run.  I would try adding "time.sleep(10)" after the
rec.delete() call.  You may need to also add an "import time" line at
the start of the file if it is not already there.  If that works, you
could just tell find_orphans.py to delete all the bad recordings and
leave it for a couple of hours while it happened.  I seem to remember
having to do something like that when I had problems with an even
older MythTV version.  If 10 seconds is insufficient, Mythbackend may
still crash at some point, but by the time it does it should have done
a lot of the deletes.

More information about the mythtv-users mailing list