[mythtv] Backend crashes (related to EIT) - possible fix attached
david at unsolicited.net
Thu Feb 21 20:53:21 UTC 2008
I've been looking into this issue further, and have a patch.
The problem is quite subtle and connected to the way Qt caches regular
expression engine instances. MythTV creates threads directly using
pthread primitives, bypassing Qt's QThread class. This is a problem,
because QThread sets up thread local data structures that it expects to
be able to use in QRegExp methods. These are uninitialised when the
thread is created outside of Qt.
The actual (mis)behaviour caused by this is rather random. QRegExp may
decide to create and destroy an engine during each regexp call, in which
case everything works OK (if more slowly that it could). At other times
threads end up sharing regexp engines and the associated control
structures. Sometimes, if two threads execute inside QRegExp
simultaneously then heap corruption occurs and the backend crashes.
Applying the attached change has seen my crashy backend (with 3 DTV
tuners) work reliably for 21 hours so far. (This is unheard of).
Please consider applying this patch (diff is against trunk earlier this
week). It changes the main thread constructs over to using QThread.
There are still some pthread calls left, but these are in areas that are
unlikely to exercise Qt. There is also a belt and braces change to
pespacket.cpp that I put in after getting uncomfortable with the
existing code. I'm not sure this fixes anything so feel free to ignore it.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7479 bytes
Desc: not available
Url : http://mythtv.org/pipermail/mythtv-dev/attachments/20080221/712e070d/attachment.bin
More information about the mythtv-dev