I know questions about WinError 10054 have been asked before, but solutions were not applicable in my case.
I have a dozen of scripts running on a daily basis, but as of yesterday a few of them crashed on the following error:
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
The scripts are both running on a local computer and a server (acceptance/production) and the strange thing is that on both machines the scripts now crash. In one case the script crashes on ftplib at the moment I try to retrieve a file from the ftp server by ftp.retrbinary(). Another script crashes when I try to close a webdriver, used for controlling the Chrome browser. Both are dependent on the socket.py library and the error traces back to: return self._sock.recv_into(b). Has there been some update recently that could cause this error?
Related
Background - using a windows machine, Windows 10/11, connected to the internet through ethernet cable. Using python's websocket-client module, on pycharm.
Problem - one fine day, out of the blue, I am no longer able to connect to FTX's websocket wss://ftx.com/ws/ on my local windows machine and kept getting the error [WinError 10060] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
I tried on my VPS, a linux machine, with the same exact code and it works fine.
Attempts to fix the problem were:
A full reformat of computer, windows 10 > windows 10, and reinstall python 3.10 and pycharm.
Then upgrading windows 10 > windows 11.
Made sure all drivers are up to date, and also reinstalling them.
Resetting network settings from Windows
Tested the websocket connection with other end point and it worked fine. eg wss://api.gemini.com/v1/marketdata/BTCUSD
None of the above worked.
My websocket connection is in a while loop something like this
while True:
try:
ws.run_forever()
time.sleep(0.2)
except:
pass
So it would keep retrying.
There was a weird behavior when, from windows, I disable, and re-enable the network adapter, the websocket connection would suddenly be successful. And if I were to disable and re-enable the network adapter again; sometimes it would continue to fail, or sometimes the connection would be successful again. Note this is while the code is still executing in the while loop.
And, if I were to stop and re-run the code, it would never work, and the error WinError 10060 would arise.
At this point I am stumped and have no clue how to solve this problem as it was totally random and out of the blue. Looking for help and advise please..!
I'd like to make a post request by whatever method to write a new point into Influxdb database called my_db, running on another PC in my local network. The PC with Influxdb 1.8 runs on Windows 10. So far I tried to use Python in this way:
import requests
requests.post(url="192.168.x.x:8086/write?db=my_db", data=my_data)
But I'm getting an error:
raise InvalidSchema("No connection adapters were found for {!r}".format(url))
requests.exceptions.InvalidSchema: No connection adapters were found for '192.168.x.x:8086/write?db=my_db'
Is there some kind of setup to be done in order to enable remote connections? Please excuse my ignorance, but I'm not very comfortable with the networking stuff. If possible, I'd like to avoid any kind authentication.
My team and I have been having some trouble with our testing infrastructure. We have test suites that run against different browsers on different platforms using different provisioned settings -- all of which works just fine. Our only issue is that from time to time, we run into strange connection failures and session errors.
Our connection failure deriving from urlib2, which the official selenium bindings are communicating with
urllib2.URLError: <urlopen error [Errno 110] Connection timed out>
Is occurring across all browsers on both our Windows and Mac nodes.
A well as our session related error,
selenium.common.exceptions.WebDriverException: Message: Session [insert-session-id-here] was terminated due to TIMEOUT
Giving some context, we have 5 maximum sessions on our windows node with 5 max instances for chrome and firefox. Our tests also run in parallel.
The connection error only occurs when we have our hub/nodes running for an extended period of time. I've found that shutting down the hub using the lifecycle manager and starting it back up seems to do the trick -- until the error appears again.
The session error occurs across different tests on different browsers unexpectedly. From what I've read it may be due to parallelization, but I have no idea what the root cause is.
Hub Configuration
https://pastebin.com/17VQHbrA
Node Configuration
https://pastebin.com/XDit2yT1
If the client closes an established connection that it has made with the flask server, I get the following error in the terminal:
[Errno 10053] An established connection was aborted by the software in your host machine
It seems when flask tries to write in the closed stream, it faces errors and hence will complain.
It seemed like a warning or so as the application does not quit after printing the error, but the problem is that my server will stop serving other requests despite being alive in the system.
I have read similar questions but they did not help. How can I prevent this issue? I use both Windows and Linux operating systems.
The cause of this problem is, as we previously discussed, insufficient permissions to perform the network operation. The remedy to the problem was to run the process as an administrator and/or to modify the system policy to allow connections on the restricted port.
PyCharm remote debugging (pydevd) does not connect with the following message:
error: [Errno 10061] No connection could be made because the target machine actively refused it
How can I troubleshoot it?
The output console in PyCharm shows:
Starting debug server at port 21000
Use the following code to connect to the debugger:
import pydevd
pydevd.settrace('*.*.*.*', port=21000, suspend=False)
Waiting for process connection...
Server stopped.
I checked the firewall and PyCharm is allowed for both incoming and outgoing connections.
10061 is WSAECONNREFUSED, 'connection refused', which means there was nothing listening at the IP:port you tried to connect to.
Though I see that you have validated its not a firewall issue, but still I would suggest to check the port numbers again with respect to the ones opened in windows firewall. Or to narrow down just run a simplehttpserver or icmp server at the same port and confirm.
In a direct link communication, it often means that you have already something connected to this port.
To check what process is hearing what port, check this SO question.
You can then either kill the program or change the port, depending of what you can do.
Without more information of the "remote tested", it is hard to know what is happening.
I was having the trouble as well (Server stopped as soon as the client connected).
Turned out that I had apparently too many breakpoints defined.
after having removed most of them and re-initiated my remote debug connection from the client (and having restarted the debug server in pycharm) it doesn't trigger anymore the "Server stopped." problem.