Repository: DamnWidget/anaconda

Issue #872: Remote interpreter in docker instance : "Unfortunately, the Windows socket is in inconsistent state, restart your sublime text 3"
Created: 2020-10-05T14:10:03Z
Expected Behaviour
Hello,
I'm trying to connect my sublime text to a remote interpreter running in a local docker using Docker Desktop.
The remote interpreter should work properly from docker image
Actual Behaviour
I get no linting and not autocompletion. After a few seconds, I get an error message in a new ST window : "Unfortunately, the Windows socket is in inconsistent state, restart your sublime text 3".
Restarting ST3 always produce the same result.
EDIT : Works fine with Anaconda v2.1.36. Seems to be a regression introduced in the 2.1.37 - More details on my following post
Steps to Reproduce
1- Docker command to run (using powershell in my case) : docker run --rm -it -v "C:\[local_path]\AppData\Roaming\Sublime Text 3\Packages\Anaconda:/opt/anaconda" -p 9999:9999 python:3.6-slim-stretch /opt/anaconda/anaconda_server/docker/start python 9999 docker_project
(I usually add a -d option, removed it to see the logs at the same time)
2- Open a sublime text project with the following .sublime-project file :
{
	"folders": [
		{
			"path": "."
		}
	],
	"settings": {
		"python_interpreter": "tcp://localhost:9999"
	}
}

3- Go to a .py file and try writing something (ex : import ...)
Notes :

This setup works on my personnal computer (EDIT : using anaconda v2.1.36 - works fine with this version, it's a 2.1.37 bug IMO)
It doesn't work on my work computer (EDIT : using the anaconda v2.1.37 - works fine after manually installing the 2.1.36)
Seeing the logs, it seems the distant anaconda minserver (running on the docker host) receives the connexions from ST3. But it shows an error at some point and I couldn't figure it out when I tried to dive into anaconda code (not familiar at all with the code base)

ST3, Anaconda and OS versions

ST3 3.2.2, build 3211
Anaconda v2.1.37
OS : Windows 10 v1909

ST3 Console Logs
After the plugin's reloading :
plugins loaded
[PackageDev.plugins_.settings] ERROR: Not a Sublime Text Settings or Project file: None
[2020-10-05 15:56:18,881 - ERROR    - PackageDev.plugins_.settings] Not a Sublime Text Settings or Project file: None
[2020-10-05 15:56:19,232 - ERROR    - root] Unfortunately, the Windows socket is in inconsistent state, restart your sublime text 3. If the problem persist, fill an issue report on:   https://github.com/DamnWidget/anaconda/issues
error: Unfortunately, the Windows socket is in inconsistent state, restart your sublime text 3. If the problem persist, fill an issue report on:   https://github.com/DamnWidget/anaconda/issues
Package Control: Skipping automatic upgrade, last run at 2020-10-05 15:22:06, next run at 2020-10-05 16:22:06 or after

Anaconda's JsonServer Logs
Note: Anaconda's JsonServer logs can be found in:

Linux: ~/.local/share/anaconda/logs
OS X: ~/Library/Logs/anaconda
Windows: %APPDATA\Anaconda\Logs

MyPy is enabled but we could not import it
DEBUG:root:bind: address=('0.0.0.0', 9999)
DEBUG:root:listen: backlog=5
INFO:root:Anaconda Server started in port 9999 with cache dir /root/.cache/jedi/docker_project and extra paths /
2020-10-05 13:56:11,393: DEBUG   : bind: address=('0.0.0.0', 9999)
2020-10-05 13:56:11,393: DEBUG   : listen: backlog=5
2020-10-05 13:56:11,394: INFO    : Anaconda Server started in port 9999 with cache dir /root/.cache/jedi/docker_project and extra paths /
INFO:root:Incomming connection from ('172.17.0.1', 44818)
INFO:root:Incomming connection from ('172.17.0.1', 44822)
INFO:root:client requests: lint
error: uncaptured python exception, closing channel <__main__.JSONHandler connected 172.17.0.1:44822 at 0x7f3b6e471a90> (<class 'AttributeError'>:'function' object has no attribute 'get' [/usr/local/lib/python3.6/asyncore.py|read|83] [/usr/local/lib/python3.6/asyncore.py|handle_read_event|423] [/usr/local/lib/python3.6/asynchat.py|handle_read|171] [/opt/anaconda/anaconda_server/minserver.py|found_terminator|94] [/opt/anaconda/anaconda_server/minserver.py|handle_command|112] [/opt/anaconda/anaconda_server/lib/anaconda_handler.py|run|49] [/opt/anaconda/anaconda_server/handlers/python_lint_handler.py|lint|49] [/opt/anaconda/anaconda_server/handlers/python_lint_handler.py|_configure_linters|163])
2020-10-05 13:56:18,893: INFO    : Incomming connection from ('172.17.0.1', 44818)
2020-10-05 13:56:18,894: INFO    : Incomming connection from ('172.17.0.1', 44822)
2020-10-05 13:56:18,904: INFO    : client requests: lint
INFO:root:Incomming connection from ('172.17.0.1', 44826)
INFO:root:Incomming connection from ('172.17.0.1', 44830)
INFO:root:client requests: autocomplete
error: uncaptured python exception, closing channel <__main__.JSONHandler connected 172.17.0.1:44830 at 0x7f3b6e8c5fd0> (<class 'AttributeError'>:'function' object has no attribute 'get' [/usr/local/lib/python3.6/asyncore.py|read|83] [/usr/local/lib/python3.6/asyncore.py|handle_read_event|423] [/usr/local/lib/python3.6/asynchat.py|handle_read|171] [/opt/anaconda/anaconda_server/minserver.py|found_terminator|94] [/opt/anaconda/anaconda_server/minserver.py|handle_command|112] [/opt/anaconda/anaconda_server/handlers/jedi_handler.py|run|29] [/opt/anaconda/anaconda_server/lib/anaconda_handler.py|run|49] [/opt/anaconda/anaconda_server/handlers/jedi_handler.py|autocomplete|71] [/opt/anaconda/anaconda_server/handlers/jedi_handler.py|script|45] [/opt/anaconda/anaconda_server/handlers/jedi_handler.py|jedi_script|52])
INFO:root:Incomming connection from ('172.17.0.1', 44834)
INFO:root:Incomming connection from ('172.17.0.1', 44838)
2020-10-05 13:56:19,211: INFO    : Incomming connection from ('172.17.0.1', 44826)
2020-10-05 13:56:19,212: INFO    : Incomming connection from ('172.17.0.1', 44830)
2020-10-05 13:56:19,223: INFO    : client requests: autocomplete
2020-10-05 13:56:19,767: INFO    : Incomming connection from ('172.17.0.1', 44834)
2020-10-05 13:56:19,771: INFO    : Incomming connection from ('172.17.0.1', 44838)

Duplicate issue #902: "Uncaptured python exception" when running remote Anaconda server (on Docker)
Created: 2021-07-28T12:08:17Z
Expected Behaviour
Remote interpreter performs linting as expected.
Actual Behaviour
Linting doesn't happen, and JSON server/minserver fails with the following error:
error: uncaptured python exception, closing channel <__main__.JSONHandler connected 172.18.0.1:58258 at 0x7f514164a7f0> (<class 'AttributeError'>:'function' object has no attribute 'get' [/opt/conda/lib/python3.8/asyncore.py|read|83] [/opt/conda/lib/python3.8/asyncore.py|handle_read_event|420] [/opt/conda/lib/python3.8/asynchat.py|handle_read|171] [/anaconda/anaconda_server/minserver.py|found_terminator|94] [/anaconda/anaconda_server/minserver.py|handle_command|112] [/anaconda/anaconda_server/lib/anaconda_handler.py|run|49] [/anaconda/anaconda_server/handlers/python_lint_handler.py|lint|49] [/anaconda/anaconda_server/handlers/python_lint_handler.py|_configure_linters|163])


Steps to Reproduce
Run remote Anaconda server on Docker either following these instructions for Docker or git cloning the Anaconda codebase and then running minserver.py on the right port as instructed here
ST3, Anaconda and OS versions
ST3 - Build 4113
Anaconda - v2.2.0 (latest)
OS - Ubuntu 18.04 running the following Docker image
ST3 Console Logs
Where do I find these logs?
Anaconda's JsonServer Logs
Note: Anaconda's JsonServer logs can be found in:

Linux: ~/.local/share/anaconda/logs
OS X: ~/Library/Logs/anaconda
Windows: %APPDATA\Anaconda\Logs
These are logs pulled from within the docker container running the Anaconda server:

(base) root@9b52fa13df86:~/.local/share/anaconda/logs# cat anaconda_jsonserver.log 
2021-07-28 11:48:01,478: DEBUG   : bind: address=('0.0.0.0', 9555)
2021-07-28 11:48:01,478: DEBUG   : listen: backlog=5
2021-07-28 11:48:01,478: INFO    : Anaconda Server started in port 9555 with cache dir /root/.cache/jedi
2021-07-28 11:48:35,027: DEBUG   : bind: address=('0.0.0.0', 9555)
2021-07-28 11:48:35,027: DEBUG   : listen: backlog=5
2021-07-28 11:48:35,027: INFO    : Anaconda Server started in port 9555 with cache dir /root/.cache/jedi
2021-07-28 11:49:23,497: INFO    : Incomming connection from ('172.18.0.1', 58140)
2021-07-28 11:49:23,497: INFO    : Incomming connection from ('172.18.0.1', 58142)
2021-07-28 11:49:23,502: INFO    : client requests: lint
2021-07-28 11:49:24,643: INFO    : Incomming connection from ('172.18.0.1', 58148)
2021-07-28 11:49:24,643: INFO    : Incomming connection from ('172.18.0.1', 58150)
2021-07-28 11:49:24,650: INFO    : client requests: lint
2021-07-28 11:50:03,795: INFO    : Incomming connection from ('172.18.0.1', 58164)
2021-07-28 11:50:03,796: INFO    : Incomming connection from ('172.18.0.1', 58168)
2021-07-28 11:50:03,805: INFO    : client requests: lint
2021-07-28 11:50:07,175: INFO    : Incomming connection from ('172.18.0.1', 58176)
2021-07-28 11:50:07,176: INFO    : Incomming connection from ('172.18.0.1', 58180)
2021-07-28 11:50:07,179: INFO    : client requests: doc
2021-07-28 11:50:11,152: INFO    : Incomming connection from ('172.18.0.1', 58184)
2021-07-28 11:50:11,152: INFO    : Incomming connection from ('172.18.0.1', 58188)
2021-07-28 11:50:11,153: INFO    : client requests: lint
2021-07-28 11:50:11,473: INFO    : Incomming connection from ('172.18.0.1', 58194)
2021-07-28 11:50:11,474: INFO    : Incomming connection from ('172.18.0.1', 58196)
2021-07-28 11:50:11,483: INFO    : client requests: lint
2021-07-28 11:51:26,830: DEBUG   : bind: address=/root/.local/share/anaconda/run/anaconda/anaconda.sock
2021-07-28 11:51:26,830: DEBUG   : listen: backlog=5
2021-07-28 11:51:26,830: INFO    : Anaconda Server started in /root/.local/share/anaconda/run/anaconda/anaconda.sock for PID 9555 with cache dir /root/.cache/jedi
2021-07-28 11:51:26,831: INFO    : process 9555 does not exists stopping server...
2021-07-28 11:51:26,831: INFO    : Closing the socket, server will be shutdown now...
2021-07-28 11:51:35,406: INFO    : Incomming connection from ('172.18.0.1', 58248)
2021-07-28 11:51:35,407: INFO    : Incomming connection from ('172.18.0.1', 58250)
2021-07-28 11:51:35,408: INFO    : client requests: lint
2021-07-28 11:51:36,572: INFO    : Incomming connection from ('172.18.0.1', 58254)
2021-07-28 11:51:36,573: INFO    : Incomming connection from ('172.18.0.1', 58258)
2021-07-28 11:51:36,584: INFO    : client requests: lint

Closing comment (2021-07-28T12:38:00Z): Also, this looks like it is related to #872 , only that I seemed to face similar issues in Linux, instead of Windows