Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Description
@anntzer@tacaswell
Hi! I have just tested the master branch on Windows and found that there is indeed a problem with the QSocketNotifier (it appeared here:#13306 (comment)). Previously, on that Windows machine, I was running my old code with QAbstractSocket which was fine, and did not test the newest version with QSocketNotifier there (my fault, sorry). I have tested on Linux, and there is no such problem there.
The code to reproduce on Windows (in Jupyter):
%matplotlibqtfrommatplotlibimportpyplotaspltplt.plot([1,2])plt.pause(.1)plt.pause(.1)plt.pause(.1)
The problem seems to be that ifsocketpair generates a socket with the samefileno value as it generated in the previouspause() call, the QSocketNotifierunexpectedly fires and hangs here:
| sn.activated.connect(lambda*args:rsock.recv(1)) |
becausenothing was actually written to the
wakeup_fd. I don't understand how that can be.Workaround fix:
rsock.set_blocking(False)@sn.activated.connectdefon_signal(*args):try:signal=rsock.recv(1)# clear the socket to re-arm the notifierexceptBlockingIOError:pass# false-trigger, nothing on rsock
What should we do with this? Is there a better solution?
Originally posted by@vdrhtc in#13306 (comment)