Android dns resolve crash
-
Hi,
Why are you creating 10 threads making get requests almost as fast as possible all the time your application is running ?
On a side note, you are leaking QNetworkAccessManager and QTimer objects.
-
Hi,
Why are you creating 10 threads making get requests almost as fast as possible all the time your application is running ?
On a side note, you are leaking QNetworkAccessManager and QTimer objects.
-
I run on another phone (Android 9, armv7) , The code work well. The mobile phone that had abnormalities is Android 5.1 armv7. I am not sure whether it depend on mobile phone .
@wantfat you do realize that
QThread *thr = new QThread(); thr->start(); while (!QAbstractEventDispatcher::instance(thr)) { thr->wait(1); }is doing nothing but delay forcefully delay the loop by 1 millisecond?
Also you don't need aQNetworkAccessManagerinstance for each get request. QNetworkAccessManager can handle 5 get requests in parallel, IIRC, and the rest is automatically queued -
@wantfat you do realize that
QThread *thr = new QThread(); thr->start(); while (!QAbstractEventDispatcher::instance(thr)) { thr->wait(1); }is doing nothing but delay forcefully delay the loop by 1 millisecond?
Also you don't need aQNetworkAccessManagerinstance for each get request. QNetworkAccessManager can handle 5 get requests in parallel, IIRC, and the rest is automatically queued -
@j-hilk After call QThread::start the eventDispatcher of thread is null, so must take a sleep wait for eventDispatcher be create, QNetworkAccessManager only one instance for per thread .
@wantfat said in Android dns resolve crash:
, QNetworkAccessManager only one instance for per thread
no, from your code, you create 10 QNetworkAccessManager instances and all live inside the main(Gui) thread
-
@wantfat said in Android dns resolve crash:
, QNetworkAccessManager only one instance for per thread
no, from your code, you create 10 QNetworkAccessManager instances and all live inside the main(Gui) thread
-
@j-hilk QMetaObject::invokeMethod(QAbstractEventDispatcher::instance(thr), ={
});
This code make sure lambda run on thr.@wantfat have you checked that ? by combining invokeMethod with a lambada the object reference pointer becomes a context pointer. I see no reason, why it should be called from the Thread instance, or I personally don't know, never tried threading in this unusual way.
-
@wantfat have you checked that ? by combining invokeMethod with a lambada the object reference pointer becomes a context pointer. I see no reason, why it should be called from the Thread instance, or I personally don't know, never tried threading in this unusual way.
@j-hilk Yes, I have checked it, this is detail info, https://stackoverflow.com/a/21653558
-
The test code work well on Qt 5.12.3, The problematic version is Qt 5.12.4 . I compared two versions of the relevant code


If method __res_init resolve fail dlsym be call, and it return a valid pointer, But it is not a thread safe function. Maybe so.
-