[Interest] QHttpMultiPart not working.
Jason H
jhihn at gmx.com
Tue Dec 16 03:22:58 CET 2014
I've been working this the past fews days and no progress. The application locks up to the point I get a Force quit or wait dialog. It seems to be locked in the file reading part.
The first header and part of a file makes it out, but it locks up exactly 80k into the first file... every time. The proxy eventually times out and sends what it has. I think this is a bug in Qt.
When I pause it when it is dead locked, I get:
0 __GI___fxstat 37 0x7ffff5529044
1 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f7e767
2 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f892e2
3 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f75079
4 QFileDevice::size() const /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f1c720
5 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff64fc0c0
6 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff64fc91c
7 QIODevice::read(char*, long long) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f231ac
8 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f26ec6
9 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff64e3d05
10 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff6578745
11 QObject::event(QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff602a326
12 QApplicationPrivate::notify_helper(QObject*, QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Widgets.so.5 0x7ffff76b08f4
13 QApplication::notify(QObject*, QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Widgets.so.5 0x7ffff76b4506
14 QCoreApplication::notifyInternal(QObject*, QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5ff5c84
15 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5ff8868
16 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff6050123
17 g_main_context_dispatch /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff4d163b6
18 ?? /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff4d16708
19 g_main_context_iteration /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff4d167ac
20 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff60505b3
... <More>
or
0 read 81 0x7ffff55296bd
1 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f754e0
2 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f8848e
3 QFileDevice::readData(char*, long long) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f1bd43
4 QIODevice::read(char*, long long) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f2340f
5 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff64fc17e
6 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff64fca72
7 QIODevice::read(char*, long long) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f231ac
8 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5f26ec6
9 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff64e3d05
10 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Network.so.5 0x7ffff6578745
11 QObject::event(QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff602a326
12 QApplicationPrivate::notify_helper(QObject*, QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Widgets.so.5 0x7ffff76b08f4
13 QApplication::notify(QObject*, QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Widgets.so.5 0x7ffff76b4506
14 QCoreApplication::notifyInternal(QObject*, QEvent*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5ff5c84
15 QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff5ff8868
16 ?? /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff6050123
17 g_main_context_dispatch /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff4d163b6
18 ?? /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff4d16708
19 g_main_context_iteration /lib/x86_64-linux-gnu/libglib-2.0.so.0 0x7ffff4d167ac
20 QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) /opt/Qt5.4.0/5.4/gcc_64/lib/libQt5Core.so.5 0x7ffff60505b3
... <More>
I would appreciate any tips on how to debug this. Qt 5.4.0
> Sent: Friday, December 12, 2014 at 1:27 PM
> From: "Jason H" <jhihn at gmx.com>
> To: "interest at qt-project.org" <interest at qt-project.org>
> Subject: [Interest] QHttpMultiPart not working.
>
> I am trying to sendmultiple files in a multiart message. I've adapted the example, and there is never a boundary or content put out for any part.
>
> First the code:
> QHttpMultiPart *multiPart = new QHttpMultiPart(QHttpMultiPart::FormDataType);
>
> foreach (QVariant v, filenames) {
> QString filename = v.toString();
>
> QString shortFilename;
> if (filename.contains("/"))
> shortFilename = filename.mid(filename.lastIndexOf("/")+1);
> else
> shortFilename = filename;
>
> QString mimeType;
> if (filename.endsWith(".png"))
> mimeType = "image/png";
> else if (filename.endsWith(".jpg") || filename.endsWith(".jpeg"))
> mimeType = "image/jpeg";
>
> QFile *file = new QFile(filename);
> if (file->open(QIODevice::ReadOnly)){
> QHttpPart imagePart;
> imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant(mimeType));
> imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(QString("form-data; name=\"%1\"").arg(shortFilename)));
> imagePart.setBodyDevice(file);
> file->setParent(multiPart); // we cannot delete the file now, so delete it with the multiPart
> multiPart->append(imagePart);
> qDebug() << "appended imgePart" << filename << shortFilename;
> } else {
> qDebug() << Q_FUNC_INFO << "Cannot open file" << filename;
> }
> } // foreach
> QNetworkReply *reply =_nam.post(QNetworkRequest(url), multiPart);
> multiPart->setParent(reply);
> connect(reply, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(completed(qint64,qint64)));
>
>
> Next, the output:
> --start---
> POST /files HTTP/1.1
> Content-Type: multipart/form-data; boundary="boundary_.oOo._MTk2MDQ2MTg0Mg==NzYxMjMyNTgyNDQ5NDA2MDk="
> MIME-Version: 1.0
> Content-Length: 407
> Connection: Keep-Alive
> Accept-Encoding: gzip, deflate
> Accept-Language: en-US,*
> User-Agent: Mozilla/5.0
> Host: localhost:10000
>
> --end----
>
> There are no parts sent.
>
> Any idea why?
>
> Thanks!
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
More information about the Interest
mailing list