[Bug][Qt6] Waitress Error Messages

Hello, I have been experiencing a bug that stacks a lot of pop-up errors on the Desktop version of Anki every time I use it. I believe this issue has been happening to me for years, and it happens on both Windows 10 and Windows 11, which are running on different computers. I’m not aware of any specific action that would cause the error to appear. They even stack up when I have only opened and left Anki running without doing anything. It has happened with Qt6 as well as older versions. I do not have, nor have ever had any add-ons. I do not have this issue with AnkiDroid. The error does not cause the program to crash, or break any functionality that I know of, but hopefully there is a solution regardless. Thank you!

Below is the error I receive:

Anki 2.1.54 (b6a7760c) Python 3.9.7 Qt 6.3.1 PyQt 6.3.1
Platform: Windows 10
Flags: frz=True ao=False sv=2
Add-ons, last update check: 2022-07-02 19:40:03

Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:62072 at 0x150457286d0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:55398 at 0x15045728160>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:61882 at 0x15045732ee0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:49738 at 0x15045743f70>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:56090 at 0x150456c97f0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:62072 at 0x150457286d0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:55398 at 0x15045728160>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:61882 at 0x15045732ee0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:61430 at 0x15045743ca0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:49738 at 0x15045743f70>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:56090 at 0x150456c97f0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket
Exception when servicing <waitress.channel.HTTPChannel connected 127.0.0.1:62072 at 0x150457286d0>
Traceback (most recent call last):
File “waitress.task”, line 84, in handler_thread
File “waitress.channel”, line 510, in service
File “waitress.server”, line 331, in pull_trigger
File “waitress.trigger”, line 96, in pull_trigger
File “waitress.trigger”, line 200, in _physical_pull
OSError: [WinError 10038] An operation was attempted on something that is not a socket

This issue has already been reported at least twice (here and here), but never solved (at least, not that I know of). This error is strange because it’s as if a socket was closed while still in usage.

Have you noticed if this error occurred when a particular window of Anki was opened (ie. the Preview, for example, or the Browser)?

I think I have an idea of what may be causing this. I can force the issue to occur by connecting to a VPN while starting Anki. From there, every time I click Decks, Add, Browse, Stats, or Sync, it will give me batches of 2 to 4 of these errors until I restart Anki. It still lets me review cards and even sync them though. I believe the issue is using a VPN in general, since it starts happening seemingly randomly, even if I was already connected beforehand.

Ah, that’s probably it. Your VPN probably resets the existing connections when it’s started, including internal connections. However, this is indeed a misbehavior: Anki’s connections (at least, those used by the webviews) do not need to be rerouted by a VPN, as they are purely internal, so the correct behavior would be to leave them untouched. Your VPN probably has an option to ignore sockets listening on localhost (assuming Anki listens on localhost, which is probably true but I’ haven’t checked).

I should emphasize that it eventually will happen regardless of if I am starting a connection. As in, the VPN can be running before Anki is launched, and maybe 10 minutes later the same issue will start occuring. For a workaround, would I be looking for a setting like “Allow LAN Traffic”?

Allowing LAN traffic is more permissive than what you should allow, but at least you can try setting that to see if it works. To be clear, there are three (to keep it simple) network “levels”:

  • Internal: network of the connections that are made from your computer to your computer. These never go out of your computer, and are only needed when different components of your computer need to speak to each other.
  • LAN: network of the connections that are made between computers in your home, ie. between those connected to the same box. These can go outside of your computer, but in principle should not be visible outside of your home.
  • Internet: network of every connection publicly visible (rougly). These will go outside of your private scope.

A VPN (Virtual Private Network) should work as a LAN but that allows you to access resources from the outside, ie. from Internet. In theory, there is no need for a VPN to interfere with connections that are made in the interal network, and these are the kind of connections that are made by several Anki components to work with each other. So, I assume that if you have an option called “Allow LAN Traffic”, it will also allow leave alone internal connections (even though the two are, in principle, not related).

Related: Anki must be able to connect to a local port - Frequently Asked Questions

Thanks for the explanation! I don’t think the VPN has separate settings for the two, but allowing LAN traffic appears to be a functioning workaround. Most of the time, I do not think it was handling local connections though, considering that Anki doesn’t instantly throw errors and that the program is still entirely functional while the errors occur. So it seems to me like it is ultimately able to work out the local connection. If I do understand this correctly, is it necessary that Anki spams my screen with errors letting me know it’s renegotiating connections, or could it have some sort of network timeout feature?

Because you have a workaround, I’m afraid this does not fall high up on the priority list.

It is a workaround with security risk implications, but if that’s how it is, I understand. Do these issues get put in a log somewhere or should I open something in Github?

I don’t have much experience with VPNs and they don’t all work the same anyways, so it’s a bit hard to tell what exactly it was doing to Anki’s connections. Keep in mind that the VPN could only work as a proxy on certain ports, and that Qt is (probably) smart enough to ditch these ports if it can’t make a connection.

To be honest, Anki does not probably handle this error very well at the moment but the real issue lies in the VPN, not in Anki. The VPN should not try to interfere at all with local connections, as this can only break things. Maybe you could try opening an issue at their issue tracker?

1 Like

I tried opening a request with them, but they don’t appear to be very receptive. I’m glad we could pin this down though. Thank you!