[SailfishDevel] Qt Network: "Network access is disabled" after network change

Slava Monich slava.monich at jolla.com
Mon May 1 09:16:34 UTC 2017


Here, I copied the most interesting parts from the bug:

Basically, QNetworkAccessManager is sometimes stuck in NotAccessible 
state after switching from mobile data to wifi.

Among other things, it makes QNetworkAccessManager::get () to fail with 
QDisabledNetworkReply which breaks XmlListModel as some people have noted.

Qt 5.2 had a similar problem but this helped:

https://git.merproject.org/mer-core/qtbase/merge_requests/3

Unfortunately, Qt connman bearer plugin has significantly changed in Qt 
5.6 and this trick stopped working.

When the switch (between mobile and wifi) is happening, the action 
occurs in parallel on two threads, Qt bearer thread and the main thread, 
the signals are queued, although the main thread is fetching the current 
state directly from the objects being manipulated by the bearer thread. 
My theory was that configurationChanged, onlineStateChanged and 
networkSessionStateChanged (queued) signals from the past were getting 
mixed with the current state (which was checked directly) in such a way 
that QNetworkAccessManagerPrivate online state remained false even 
though connman service was getting successfully connected. So I came up 
with this:

https://git.merproject.org/mer-core/qtbase/merge_requests/18

but that didn't quite fix it. It does eliminate one scenario (described 
in the merge request) but there must be something else there. The whole 
connman bearer plugin thing looks generally prone to race conditions, I 
would've done it differently but we have what we have.

Cheers,
-Slava


> Thanks for the quick reply;
> I was actually hoping to collect some more background intel on this issue.
>
>
> On Sun, Apr 30, 2017 at 10:56 PM, Slava Monich <slava.monich at jolla.com 
> <mailto:slava.monich at jolla.com>> wrote:
>
>     Unfortunately, no, it's an internal bug. If you would like to be
>     notified via email about a potential fix, you could watch qtbase
>     pull requests - those are quite rare, it shouldn't be too much of
>     a spam.
>
>     Cheers,
>     -Slava
>
>
>
>>     Hi Slava;
>>     is there a MER bug for this?
>>
>>     tortoisedoc
>>
>>     On Sun, Apr 23, 2017 at 11:33 AM, Slava Monich
>>     <slava.monich at jolla.com <mailto:slava.monich at jolla.com>> wrote:
>>
>>         Network status detection in Qt 5.6 is unreliable when the
>>         system is switching between wifi and mobile data. That
>>         results in QNetworkAccessManager sometimes thinking that
>>         network access is disabled when in fact the device is online.
>>         At some point I attempted to fix it
>>         (https://git.merproject.org/mer-core/qtbase/commit/8122f32a
>>         <https://git.merproject.org/mer-core/qtbase/commit/8122f32a>)
>>         however that only eliminated one particular scenario of
>>         failure and reduced the probability. But it's still
>>         happening. As I understood it's a random thing (race
>>         condition) triggered by two connman services changing their
>>         status more or less simultaneously.
>>
>>         Jolla's Weather app also uses XmlListModel and suffers from
>>         the same issue.
>>
>>         Nobody at Jolla is actively working on it at the moment, our
>>         resources are limited these days. If somebody has an idea how
>>         to fix it, feel free to submit a pull request against mer-5.6
>>         branch
>>         (https://git.merproject.org/mer-core/qtbase/commits/mer-5.6
>>         <https://git.merproject.org/mer-core/qtbase/commits/mer-5.6>).
>>
>>         Best regards,
>>         -Slava
>>
>>
>>             Hi,
>>
>>             The same happens in my Rush hour app available in
>>             OpenRepos. My only connection to network is via
>>             QtQuick.XmlListModel 2.0. I am using Jolla C and the
>>             latest Iijoki 2.1.0.11
>>
>>             https://github.com/Rikujolla/trafficviewer/issues/2
>>             <https://github.com/Rikujolla/trafficviewer/issues/2>
>>
>>             Best regards, Riku
>>
>>             Sebastian Wolf kirjoitti sunnuntai 23. huhtikuuta 2017:
>>
>>                 Hi colleagues,
>>                   some users of my application Piepmatz are reporting
>>                 network issues when their
>>                 device network connection changes from WiFi to
>>                 Cellular and vice versa. I
>>                 couldn't reproduce it so far with my FP2 on 2.0.5. As
>>                 I'm only using standard Qt
>>                 Network classes to access the internet and no own
>>                 network detection and
>>                 especially that not only my application is affected,
>>                 it could possibly be
>>                 something in 2.1 itself. For some details see GitHub
>>                 issue
>>                 https://github.com/Wunderfitz/harbour-piepmatz/issues/11
>>                 <https://github.com/Wunderfitz/harbour-piepmatz/issues/11>
>>                   Didn't find anything with a quick search on
>>                 together.jolla.com <http://together.jolla.com>, so
>>                 does somebody
>>                 of you know something about such an issue?
>>                   Thanks for any hints and best regards, Sebastia
>>
>>
>>         _______________________________________________
>>         SailfishOS.org Devel mailing list
>>         To unsubscribe, please send a mail to
>>         devel-unsubscribe at lists.sailfishos.org
>>         <mailto:devel-unsubscribe at lists.sailfishos.org>
>>
>>
>>
>>
>>     _______________________________________________
>>     SailfishOS.org Devel mailing list
>>     To unsubscribe, please send a mail todevel-unsubscribe at lists.sailfishos.org
>>     <mailto:devel-unsubscribe at lists.sailfishos.org>
>     _______________________________________________ SailfishOS.org
>     Devel mailing list To unsubscribe, please send a mail to
>     devel-unsubscribe at lists.sailfishos.org
>     <mailto:devel-unsubscribe at lists.sailfishos.org> 
>
> _______________________________________________
> SailfishOS.org Devel mailing list
> To unsubscribe, please send a mail to devel-unsubscribe at lists.sailfishos.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20170501/da5062c3/attachment-0001.html>


More information about the Devel mailing list