"We are running MATLAB with Jupyter in a docker container based on this repository: https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/tree/main/matlab. We are having issues with handling licenses in the containers; basically, if we start a container, log in to MATLAB, then stop the container, then start a new container from the same image, we cannot log in to MATLAB using the same credentials.
You should be able to reproduce it by running the following code:
git clone [https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter.git](https://protect-us.mimecast.com/s/uCSbCo2m9DFomEJyfzA41v?domain=github.com)
pushd matlab-integration-for-jupyter/matlab
sudo docker build -t matlab-notebook .
sudo docker run -it -p 8888:8888 --mount type=bind,source=“<a local directory>",target=/home/jovyan matlab-notebook
# Open the link that is printed out and sign in to MATLAB
Ctrl+C
sudo docker run -it -p 8888:8888 --mount type=bind,source=“<a local directory>",target=/home/jovyan matlab-notebook
# Open the link that is printed out and try to sign in to MATLAB again.
There will also be an error message in the console that says this:
INFO:MATLABProxyApp:Environment variable MWI_CUSTOM_HTTP_HEADERS is not set, hence no custom HTTP headers are applied.
INFO:MATLABProxyApp:Successfully validated provided jupyter configuration
INFO:MATLABProxyApp:Found cached licensing information...
INFO:charset_normalizer:Detected declarative mark in sequence. Priority +1 given for utf_8.
INFO:charset_normalizer:utf_8 passed initial chaos probing. Mean measured chaos is 0.000000 %
INFO:charset_normalizer:We detected language [('English', 1.0), ('Dutch', 1.0), ('Indonesian', 1.0), ('French', 1.0)] using utf_8
INFO:charset_normalizer:utf_8 is most likely the one. Stopping the process.
INFO:MATLABProxyApp:Saving licensing information...
INFO:MATLABProxyApp:Successful re-use of cached information.
INFO:MATLABProxyApp:MATLAB_LOG_DIR:/tmp/MWI/31511
INFO:MATLABProxyApp:MATLAB_READY_FILE:/tmp/MWI/31511/connector.securePort
INFO:MATLABProxyApp:Starting MATLAB on port 31511
INFO:MATLABProxyApp:Using MWI_APP_PORT to launch the server
INFO:MATLABProxyApp:Starting MATLAB proxy app
INFO:MATLABProxyApp: with base_url: /matlab and app_port:50009.
INFO:MATLABProxyApp:
The MATLAB Proxy can be accessed on http://localhost:50009/matlab/index.html
MATLAB is selecting SOFTWARE OPENGL rendering.
[I 2022-02-02 15:22:20.406 ServerApp] 302 GET /matlab/ (172.17.0.1) 2625.34ms
[I 2022-02-02 15:22:20.909 ServerApp] 302 GET /matlab/manifest.json (172.17.0.1) 0.92ms
INFO:MATLABProxyApp:Waiting for MATLAB to exit...
INFO:MATLABProxyApp:MATLAB has exited with errorcode: 1
ERROR:MATLABProxyApp:Usage of MathWorks Online Licensing failed. For more details, see https://github.com/mathworks/matlab-proxy/blob/main/MATLAB_Licensing_Info.md.
License Manager Error 4402
License Manager Error 4402
Transaction failed
It’s possible that you will have to run the docker image more than twice to trigger the issue.
We’ve found that if we explicitly log out of MATLAB before killing the container that this issue does not happen. However, every time someone forgets to do that they have to wait a couple of hours before they can log in again.
If you hit the “log out” button after getting the error and then log in again, you get the same error. "
This error can be avoided by shutting down MATLAB before killing a container running it. This will ensure that the checked out license is returned before spinning up another container.
Creating this issue on behalf of "Lee Savoie"
Listed below is the description of the issue:
"We are running MATLAB with Jupyter in a docker container based on this repository: https://github.com/mathworks-ref-arch/matlab-integration-for-jupyter/tree/main/matlab. We are having issues with handling licenses in the containers; basically, if we start a container, log in to MATLAB, then stop the container, then start a new container from the same image, we cannot log in to MATLAB using the same credentials.
You should be able to reproduce it by running the following code:
At this point, there will be an error message stating: MathWorks Online Licensing failed. For more details, see https://github.com/mathworks/jupyter-matlab-proxy/blob/main/MATLAB-Licensing-Info.md.
There will also be an error message in the console that says this:
INFO:MATLABProxyApp:Environment variable MWI_CUSTOM_HTTP_HEADERS is not set, hence no custom HTTP headers are applied. INFO:MATLABProxyApp:Successfully validated provided jupyter configuration INFO:MATLABProxyApp:Found cached licensing information... INFO:charset_normalizer:Detected declarative mark in sequence. Priority +1 given for utf_8. INFO:charset_normalizer:utf_8 passed initial chaos probing. Mean measured chaos is 0.000000 % INFO:charset_normalizer:We detected language [('English', 1.0), ('Dutch', 1.0), ('Indonesian', 1.0), ('French', 1.0)] using utf_8 INFO:charset_normalizer:utf_8 is most likely the one. Stopping the process. INFO:MATLABProxyApp:Saving licensing information... INFO:MATLABProxyApp:Successful re-use of cached information. INFO:MATLABProxyApp:MATLAB_LOG_DIR:/tmp/MWI/31511 INFO:MATLABProxyApp:MATLAB_READY_FILE:/tmp/MWI/31511/connector.securePort INFO:MATLABProxyApp:Starting MATLAB on port 31511 INFO:MATLABProxyApp:Using MWI_APP_PORT to launch the server INFO:MATLABProxyApp:Starting MATLAB proxy app INFO:MATLABProxyApp: with base_url: /matlab and app_port:50009. INFO:MATLABProxyApp: The MATLAB Proxy can be accessed on http://localhost:50009/matlab/index.html MATLAB is selecting SOFTWARE OPENGL rendering. [I 2022-02-02 15:22:20.406 ServerApp] 302 GET /matlab/ (172.17.0.1) 2625.34ms [I 2022-02-02 15:22:20.909 ServerApp] 302 GET /matlab/manifest.json (172.17.0.1) 0.92ms INFO:MATLABProxyApp:Waiting for MATLAB to exit... INFO:MATLABProxyApp:MATLAB has exited with errorcode: 1 ERROR:MATLABProxyApp:Usage of MathWorks Online Licensing failed. For more details, see https://github.com/mathworks/matlab-proxy/blob/main/MATLAB_Licensing_Info.md. License Manager Error 4402 License Manager Error 4402 Transaction failed
Troubleshoot this issue by visiting: https://www.mathworks.com/support/lme/R2021b/4402
Diagnostic Information: Feature: MATLAB License path: Licensing error: 4402,0.
It’s possible that you will have to run the docker image more than twice to trigger the issue.
We’ve found that if we explicitly log out of MATLAB before killing the container that this issue does not happen. However, every time someone forgets to do that they have to wait a couple of hours before they can log in again.
If you hit the “log out” button after getting the error and then log in again, you get the same error. "