Segmentation fault for scoped references with multiple QNetworkReply objects
Maurizio Berti
maurizio.berti at gmail.com
Mon Aug 12 17:46:21 BST 2024
Il giorno lun 12 ago 2024 alle ore 11:02 Phil Thompson <
phil at riverbankcomputing.com> ha scritto:
> First off, I can't reproduce the problem - even if I double the number
>
> of URLs to 200.
>
That's odd.
I just tried on another VM (lubuntu 24.04 on live cd) and I can still
reproduce both with the builtin PyQt5 (Qt 5.15.13, PyQt 5.15.10) and PyQt6
(6.7.1) installed through pip.
In some cases it never even get beyond 10 finished replies, and this also
seems to be related by the number of current requests: if I reduce the
timer interval to 10-20ms in some cases it just segfaults at the very first
finished reply (I can see it if I connect to the "doSomething" function
before any other).
I suppose then that it's also related to the number of currently
active/queued requests, so maybe in my case it fails almost always due to
the relatively slow network speed I have (also decreased by the VM
bottleneck)
Can you try by decreasing the timeout interval and slowing down the
response time?
I made some reliable tests with https://httpbin.org/delay/1 (one second
delay), PyQt6 gets rarely more than 20 results before fault, Qt5 often
crashes on the very first one.
However looking at the reply object using sip.dump() shows it has no
> parent wrapped object whereas the docs for QNetworkReply::manager()
> state that the manager is the reply's parent. Adding a /Transfer/
> annotation to QNetworkManager::get() fixes this - but I have no idea if
> this has any effect on your test case.
>
That would be interesting to explore, but I wouldn't be able to build/test
it on my own.
How come that sip.dump() doesn't show the parent, while I'm able to print
out both manager() and parent()?
In the meantime, I decided to create a persistent list for the replies, and
then remove each one when finished/destroyed.
It seems to work so far, both in the provided MRE (including the stress
cases above) and in my actual program.
Thanks,
MaurizioB
--
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
http://www.jidesk.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20240812/bb98edc0/attachment.htm>
More information about the PyQt
mailing list