tray
tray copied to clipboard
RemoteEndpoint unavailable, outgoing connection not open after connection is gone
If sending a lot of requests to QZ Tray outside of a promise loop, it can queue up many replies. Take this code snippet for example:
setInterval(function() {
qz.printers.find().then(
function(printers) {
console.log(printers);
}
) }, 100 /* 100 ms will cause this issue! */
);
If this mistake is made, QZ Tray doesn't send any replies to queries (e.g. qz.printers.find(...)
) until all of the orphaned messages clear. This gives a symptom that QZ Tray is non-responsive when really it's just being a bit optimistic about the availability of that orphaned connection.
This shows over and over in the QZ Tray logs:
org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, outgoing connection not open
Once the queued requests are done, the new calls to qz.printers.find(...)
finally are returned (which could take minutes).
@bberenz just pointing out that #483 combined with this bug report confused me. Perhaps we have different handling between finding printers and printing content? I'm not sure if they hit related code, but they may be worth tackling together (finish the tasks in the current request, but don't allow any new ones, perhaps?)