Re: QNetworkAccessManager smart handling of timeouts / network errors
i'm probably having a similar issue to what is discussed here, please also see:
https://qt-project.org/forums/viewthread/11763
i've created a minimal QCoreApplication example and engineered a network setup which is reproducible on your system, so in a nutshell: you can now reproduce this bug, see:
https://github.com/qknight/qt-QNetwo...9f2ef661d4dcb1
*there is one difference though*:
i had this issue also with *QNetworkAccessManager* but after playing with the issue for a while (/etc/resolv.conf) i now think it is DNS related so i was looking into *QHostInfo::lookupHost*
but the *README.MD* contains a detailed description of the setup and tests i was using/doing.
i'm using:
* qt-4.8.4
* nixos linux (nixos.org)
* kernel 3.4.56
some experiments
i made some experiments with iptables and since DNS uses UDP on my system (not TCP as shown in the rules above) i modified them slightly:
iptables -D OUTPUT -d 8.8.8.8 -j DROP
surprisingly this rule made the shutdown process, which would normally timeout with 40 seconds, succeed in no time (say 5ms). for some reason a local process just knows that the DNS resolver fails.
gethostip shows the same behaviour:
% time gethostip lastlog.de
lastlog.de: Unknown host
gethostip lastlog.de 0.00s user 0.00s system 75% cpu 0.005 total
summary: using the iptables rule does not help to reproduce the issue but hides it instead! so better use this setup to reproduce it:
host pc ---- switch1 ---- switch2 ----- internet
and then unplug switch2 so that networkmanager/ifplugd (or similar) won't notice that the cable has been unplugged.
anyway, have a look at the README.MD file in the repo above. as described there i will now try to modify the Qt toolkit to ignore the DNS resoler on shutdown - maybe that is possible.
feedback welcome. my jabber: flux@jabber.ccc.de
best wishes,
joachim schiele
Re: QNetworkAccessManager smart handling of timeouts / network errors
Does the same thing happen when using code that doesn't make use of Qt? If no, what are the differences in code and behavior, if yes - why are you asking this question relating it to Qt?
Re: QNetworkAccessManager smart handling of timeouts / network errors
i've made some traces and an minimal example to illustrate the problem, my repo on github.com linked below.
discussion
qt-QNetworkAccessManager-issues discussion:
https://github.com/qknight/qt-QNetwo...593#discussion
possible solution(s)
qt-QNetworkAccessManager-issues solution(s):
https://github.com/qknight/qt-QNetwo...ible-solutions
summary: in a nutshell
Qt's getaddrinfo(..) abstraction must be changed to make the lookupHost(..) call _really_ async. right now it is sync, when the network connection between client and DNS server is interrupted, which isn't that seldom as one might expect.
should i fill a bug report? this problem isn't solved at all! ;-)
Re: QNetworkAccessManager smart handling of timeouts / network errors
i’ve added a new bug here, hope this is the right tracker!
https://bugreports.qt-project.org/browse/QTBUG-33391
thanks
Re: QNetworkAccessManager smart handling of timeouts / network errors
@krsmichael Thank you so much! Adding those dlls worked for me. It seems Qt will write empty files if there is a network error. I was checking for this in my app to isolate the problem. My app downloads from an https site. Worked on my development PC (Windows 10) because Qt was in the path of the user and the files are located in the folder QtCreator/bin. But running my app in VirtualBox failed because it couldn't find the dlls. Thanks again so much!