[mythtv-commits] Ticket #13404: QT5: QFileInfo is not registered to QMetaType at startup anymore
MythTV
noreply at mythtv.org
Sat Feb 9 13:21:47 UTC 2019
#13404: QT5: QFileInfo is not registered to QMetaType at startup anymore
----------------------------------+--------------------------
Reporter: rcrdnalor | Owner: (none)
Type: Patch - Bug Fix | Status: new
Priority: minor | Milestone: needs_triage
Component: MythTV - General | Version: v29-fixes
Severity: medium | Keywords:
Ticket locked: 0 |
----------------------------------+--------------------------
QT5: QFileInfo is not a registered QMetaType at startup anymore
When I use the Services API to retrieve a preview on a freshly booted
backend,
I get an empty xml file, if it is run straight after start of mythbackend:
{{{
wget -O preview.png http://<be-
address>:6544/Content/GetPreviewImage?RecordedId=<n>
}}}
The preview.png looks like an xml file holding the xml body only:
{{{
$ cat ./preview.png
<?xml version="1.0" encoding="UTF-8"?><></>
}}}
The second attempt works as expected and returns a valid preview.png
Note: This causes missing icons or thumbnails in MythWeb:
Missing previews in MythWeb:
{{{
https://code.mythtv.org/trac/ticket/10707#comment:10
https://code.mythtv.org/trac/ticket/10707#comment:11
}}}
Missing Channel Icons in MythWeb:
{{{
https://lists.gt.net/mythtv/users/620286
https://forum.mythtv.org/viewtopic.php?f=6&t=2578&p=12580&hilit=icon#p12580
}}}
Every mornig, when I fire up MythWeb, I get these missing thumbnails.
MythWeb causes the httpworker of mythtv to spawn multiple threads at the
same time,
therefore, the first 5 or 6 previews are corrupt.
The reason for this is that in the file 'servicehost.cpp', the
method 'QVariant MethodInfo::Invoke' tries to get the !MetaType-index of
'QFileInfo'
at line 81:
{{{
int nRetIdx = QMetaType::type( m_oMethod.typeName() );
}}}
but QFileInfo is not registered to QMetaType at this time.
Note: After the first call, the type gets registered, because the
Content Service 'QFileInfo Content::!GetPreviewImage' is actually called.
Below the log excerpt with the applied path
(01_add_logging_to_methodinfo_invoke.patch)
for more verbosity. The log is done using the following loglevels:
'general:err,http:debug'
{{{
I CoreContext httpserver.cpp:466 (HttpWorker) HttpWorker(9): New
connection
I HttpServer9 httprequest.cpp:1140 (GetParameters) sParams:
'RecordedId=10'
I HttpServer9 httprequest.cpp:1332 (ParseRequest) (Request Header)
accept: */*
I HttpServer9 httprequest.cpp:1332 (ParseRequest) (Request Header)
accept-encoding: identity
I HttpServer9 httprequest.cpp:1332 (ParseRequest) (Request Header)
connection: Keep-Alive
I HttpServer9 httprequest.cpp:1332 (ParseRequest) (Request Header) host:
A.B.C.D:6544
I HttpServer9 httprequest.cpp:1332 (ParseRequest) (Request Header) user-
agent: Wget/1.19.4 (linux-gnu)
I HttpServer9 httprequest.cpp:1644 (ExtractMethodFromURL)
ExtractMethodFromURL(end) : GetPreviewImage : /Content
D HttpServer9 httpserver.cpp:376 (DelegateRequest) m_sBaseUrl: /Content
I HttpServer9 servicehost.cpp:325 (ProcessRequest)
ServiceHost::ProcessRequest: GetPreviewImage : GET
/Content/GetPreviewImage?RecordedId=10 HTTP/1.1
D HttpServer9 servicehost.cpp:85 (Invoke) MethodInfo::Invoke: nRetIndx is
'0' and type is 'QFileInfo'.
I HttpServer9 httprequest.cpp:369 (SendResponse)
HTTPRequest::SendResponse(xml/html) () :200 OK -> W.X.Y.Z: 8
D HttpServer9 httprequest.cpp:419 (SendResponse) Reponse Content Length:
44
D HttpServer9 httprequest.cpp:450 (SendResponse) Response header size:
400 bytes
W HttpServer9 httpserver.cpp:645 (run) HttpWorker(9): Error The remote
host closed the connection (1)
I HttpServer9 httpserver.cpp:693 (run) HttpWorker(9): Connection -1
closed. 1 requests were handled
I CoreContext housekeeper.cpp:725 (Run) Queueing HouseKeeperTask
'DBCleanup'.
I CoreContext housekeeper.cpp:725 (Run) Queueing HouseKeeperTask
'JobQueueRecover'.
I CoreContext housekeeper.cpp:725 (Run) Queueing HouseKeeperTask
'LogClean'.
....
I CoreContext httpserver.cpp:466 (HttpWorker) HttpWorker(58): New
connection
I HttpServer58 httprequest.cpp:1140 (GetParameters) sParams:
'RecordedId=10'
I HttpServer58 httprequest.cpp:1332 (ParseRequest) (Request Header)
accept: */*
I HttpServer58 httprequest.cpp:1332 (ParseRequest) (Request Header)
accept-encoding: identity
I HttpServer58 httprequest.cpp:1332 (ParseRequest) (Request Header)
connection: Keep-Alive
I HttpServer58 httprequest.cpp:1332 (ParseRequest) (Request Header) host:
A.B.C.D:6544
I HttpServer58 httprequest.cpp:1332 (ParseRequest) (Request Header) user-
agent: Wget/1.19.4 (linux-gnu)
I HttpServer58 httprequest.cpp:1644 (ExtractMethodFromURL)
ExtractMethodFromURL(end) : GetPreviewImage : /Content
D HttpServer58 httpserver.cpp:376 (DelegateRequest) m_sBaseUrl: /Content
I HttpServer58 servicehost.cpp:325 (ProcessRequest)
ServiceHost::ProcessRequest: GetPreviewImage : GET
/Content/GetPreviewImage?RecordedId=10 HTTP/1.1
D HttpServer58 servicehost.cpp:85 (Invoke) MethodInfo::Invoke: nRetIndx
is '1178' and type is 'QFileInfo'.
I HttpServer58 httprequest.cpp:358 (SendResponse)
HTTPRequest::SendResponse( File ) :200 OK -> W.X.Y.Z:
I HttpServer58 httprequest.cpp:503 (SendResponseFile) SendResponseFile (
/mnt/data01/my_data01/recordings/3006_20180804082700.mkv.png )
I HttpServer58 httprequest.cpp:1128 (TestMimeType)
HTTPRequest::TestMimeType(/mnt/data01/my_data01/recordings/3006_20180804082700.mkv.png)
- type is image/png
D HttpServer58 httprequest.cpp:611 (SendResponseFile) Response header
size: 471 bytes
W HttpServer58 httpserver.cpp:645 (run) HttpWorker(58): Error The remote
host closed the connection (1)
I HttpServer58 httpserver.cpp:693 (run) HttpWorker(58): Connection -1
closed. 1 requests were handled
}}}
These stanzas indicate that something went wrong:
{{{
MethodInfo::Invoke: nRetIndx is '0' and type is 'QFileInfo'.
HTTPRequest::SendResponse(xml/html) () :200 OK -> W.X.Y.Z: 8"
}}}
Analysis:
Up to fixes/29, the 'QFileInfo' type was registered to 'QMetaType',
but only for QT4:
See File 'libs/libmythservicecontracts/service.h' from branch fixes/29:
{{{
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Q_DECLARE_METATYPE( QFileInfo )
inline Service::Service(QObject *parent) : QObject(parent)
{
qRegisterMetaType< QFileInfo >();
}
#else
inline Service::Service(QObject *parent) : QObject(parent) {}
#endif
}}}
This explains, that this bug is not visible in fixes/0.27 (QT4)
and is a regression since v28 (QT5).
For QT5, it is not necessary anymore to declare the metatype,
because this is already done in in the header file of <QFileInfo>,
but registering 'QFileInfo' seems to be necessary for MythTV Services.
See attached patches 02_register_qfileinfo_at_startup_v29.patch
and 02_register_qfileinfo_at_startup_v30_master.patch
The patch for master is compile time tested, only.
Enclosed the mythtv version (mythtv_version.txt).
--
Ticket URL: <https://code.mythtv.org/trac/ticket/13404>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list