mathworks / jupyter-matlab-proxy

MATLAB Integration for Jupyter enables you to run MATLAB code in Jupyter Notebooks and other Jupyter environments. You can also open MATLAB in a browser directly from your Jupyter environment to use more MATLAB features.
Other
283 stars 36 forks source link

Detecting port to be used in Docker setup #13

Closed matuskosut closed 2 years ago

matuskosut commented 3 years ago

Docker setup - Jupyterhub + DockerSpawner + Jupyterlab

current port check: https://github.com/mathworks/jupyter-matlab-proxy/blob/main/jupyter_matlab_proxy/app_state.py#L339

Main issue: If TMPDIR is shared between users, but each user environment is spawn in separate container, MATLAB will go ahead and assign same port to each of them. Only the first one owning the tmp directory will be able to write to tmp directory. Other users will fail to start MATLAB.

/opt/conda/lib/python3.8/site-packages/aiohttp/web_urldispatcher.py:237: RuntimeWarning: coroutine 'Process.wait' was never awaited
  super().__init__(match_dict)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
INFO:MATLABProxyApp:Cleaning up matlab_ready_file.../tmp/MWI/31511/connector.securePort

Potentially if setting separate TMPDIR per user we manage to avoid the main problem. But user can spawn multiple containers (Jupyterhub feature) so I expect each container will end up having the same port 31511, could this cause issues if all instances of the user are using same temporary directory (/tmp/MWI/31511/connector.securePort)?

prabhakk-mw commented 3 years ago

Hi @matuskosut We are working on it, and will update this space with any updates we might have.

Thank you for reporting this!

matuskosut commented 3 years ago

@prabhakk-mw no problem. Thanks for all the good work so far! There was a lot of improvement in the recent versions.

prabhakk-mw commented 2 years ago

This has been fixed by https://github.com/mathworks/matlab-proxy/commit/8d2bccd01b9a60b3349bef70d6cdc14cdb8e7a48

prabhakk-mw commented 2 years ago

Please re-install the following packages:

$ python -m pip install matlab-proxy --upgrade $ python -m pip install jupyter-matlab-proxy --upgrade