Closed kkrick-sdsu closed 1 month ago
Hi @kkrick-sdsu
Haven't read all the links as I'm mobile, but does the environment variable MWI_SHUTDOWN_ON_IDLE_TIMEOUT as described in the advanced usage readme serve the purpose?
Thanks, I will give this a try and share an update here.
Hey @kkrick-sdsu
Did that environment variable serve the purpose?
Thanks for following up! I am reaching out to the user for confirmation if this change resolved the timeout issue.
@kkrick-sdsu , any news?
Awaiting confirmation from the user, will let you asap.
Hello,
The user has tested this updated container image and confirmed that this does not solve the problem.
Is there anything else that I could try?
Let's begin with a description of the issue.
Assuming that you are working with this Dockerfile
>> !env
Thanks
PS: It might be easier to communicate with each other if you or your user is able to get in touch with us through MathWorks Technical Support .
Below is the full Dockerfile that we are using.
jupyter lab
SHELL=/bin/bash
NV_LIBCUBLAS_VERSION=11.10.3.66-1
NVIDIA_VISIBLE_DEVICES=none
KUBERNETES_SERVICE_PORT_HTTPS=443
NV_NVML_DEV_VERSION=11.7.91-1
NV_CUDNN_PACKAGE_NAME=libcudnn8
JUPYTERHUB_ADMIN_ACCESS=1
KUBERNETES_SERVICE_PORT=443
no_proxy=0.0.0.0,localhost,127.0.0.1
PROXY_API_SERVICE_HOST=10.104.61.87
NV_LIBNCCL_DEV_PACKAGE=libnccl-dev=2.13.4-1+cuda11.7
NV_LIBNCCL_DEV_PACKAGE_VERSION=2.13.4-1
JUPYTERHUB_SERVICE_URL=http://0.0.0.0:8888/user/kkrick@sdsu.edu/
HOSTNAME=jupyter-kkrick-40sdsu-2eedu
LANGUAGE=en_US.UTF-8
JUPYTERHUB_API_TOKEN=2474ed0d11f5465e969c50b6b7a89f26
PCT_ENABLED=true
NVIDIA_REQUIRE_CUDA=cuda>=11.7 brand=tesla,driver>=450,driver<451 brand=tesla,driver>=470,driver<471 brand=unknown,driver>=470,driver<471 brand=nvidia,driver>=470,driver<471 brand=nvidiartx,driver>=470,driver<471 brand=geforce,driver>=470,driver<471 brand=geforcertx,driver>=470,driver<471 brand=quadro,driver>=470,driver<471 brand=quadrortx,driver>=470,driver<471 brand=titan,driver>=470,driver<471 brand=titanrtx,driver>=470,driver<471 brand=tesla,driver>=510,driver<511 brand=unknown,driver>=510,driver<511 brand=nvidia,driver>=510,driver<511 brand=nvidiartx,driver>=510,driver<511 brand=geforce,driver>=510,driver<511 brand=geforcertx,driver>=510,driver<511 brand=quadro,driver>=510,driver<511 brand=quadrortx,driver>=510,driver<511 brand=titan,driver>=510,driver<511 brand=titanrtx,driver>=510,driver<511
PROXY_API_SERVICE_PORT=8001
NV_LIBCUBLAS_DEV_PACKAGE=libcublas-dev-11-7=11.10.3.66-1
NV_NVTX_VERSION=11.7.91-1
MATLAB_LOG_DIR=/home/jovyan/.matlab/MWI/hosts/jupyter-kkrick-40sdsu-2eedu/ports/37055
JUPYTERHUB_BASE_URL=/
NB_UID=1000
NV_CUDA_CUDART_DEV_VERSION=11.7.99-1
NV_LIBCUSPARSE_VERSION=11.7.4.91-1
NV_LIBNPP_VERSION=11.7.4.75-1
OSG_LD_LIBRARY_PATH=/opt/matlab/sys/openscenegraph/lib/glnxa64
MEM_LIMIT=8589934592
NCCL_VERSION=2.13.4-1
PROXY_PUBLIC_PORT_80_TCP=tcp://10.107.76.62:80
PROXY_PUBLIC_PORT=tcp://10.107.76.62:80
PROXY_PUBLIC_SERVICE_PORT_HTTP=80
MW_CRASH_MODE=native
PWD=/home/jovyan
MATLAB_WORKER_CONFIG_ENABLE_LOCAL_PARCLUSTER=true
capabilities_avoidTiledLayout=true
MW_CONTEXT_TAGS=MATLAB_PROXY:JUPYTER:MPM:V1,MATLAB_PROXY:JUPYTER:V1
NV_CUDNN_PACKAGE=libcudnn8=8.5.0.96-1+cuda11.7
NVIDIA_DRIVER_CAPABILITIES=compute,utility
MWI_ENABLE_TOKEN_AUTH=True
NV_NVPROF_DEV_PACKAGE=cuda-nvprof-11-7=11.7.101-1
MEM_GUARANTEE=8589934592
NV_LIBNPP_PACKAGE=libnpp-11-7=11.7.4.75-1
BASEMATLABPATH=
NV_LIBNCCL_DEV_PACKAGE_NAME=libnccl-dev
JUPYTER_IMAGE=kkricksdsu/matlab-notebook:pulmonary-v1.4
PROXY_API_PORT_8001_TCP_ADDR=10.104.61.87
TZ=Etc/UTC
HUB_SERVICE_HOST=10.106.178.160
NV_LIBCUBLAS_DEV_VERSION=11.10.3.66-1
MWI_BASE_URL=/user/kkrick@sdsu.edu/matlab
NVIDIA_PRODUCT_NAME=CUDA
JUPYTERHUB_SERVER_NAME=
NV_LIBCUBLAS_DEV_PACKAGE_NAME=libcublas-dev-11-7
LD_PRELOAD=
JUPYTERHUB_DEFAULT_URL=/lab
NV_CUDA_CUDART_VERSION=11.7.99-1
HOME=/home/jovyan
LANG=en_US.UTF-8
KUBERNETES_PORT_443_TCP=tcp://10.96.0.1:443
JPY_API_TOKEN=2474ed0d11f5465e969c50b6b7a89f26
PROXY_API_PORT_8001_TCP_PORT=8001
HUB_SERVICE_PORT=8081
CUDA_VERSION=11.7.1
NB_GID=100
NV_LIBCUBLAS_PACKAGE=libcublas-11-7=11.10.3.66-1
NV_CUDA_NSIGHT_COMPUTE_DEV_PACKAGE=cuda-nsight-compute-11-7=11.7.1-1
TOOLBOX=/opt/matlab/toolbox
JUPYTERHUB_SERVICE_PREFIX=/user/kkrick@sdsu.edu/
PYDEVD_USE_FRAME_EVAL=NO
JUICE_PATH=/var/juice
MW_DOCROOT=ui/webgui/src
JUPYTERHUB_OAUTH_CALLBACK_URL=/user/kkrick@sdsu.edu/oauth_callback
MKL_DOMAIN_NUM_THREADS=
NV_LIBNPP_DEV_PACKAGE=libnpp-dev-11-7=11.7.4.75-1
PROXY_PUBLIC_SERVICE_HOST=10.107.76.62
NV_LIBCUBLAS_PACKAGE_NAME=libcublas-11-7
PROXY_PUBLIC_PORT_80_TCP_PROTO=tcp
JUPYTERHUB_OAUTH_CLIENT_ALLOWED_SCOPES=[]
HUB_PORT=tcp://10.106.178.160:8081
PRE_LD_PRELOAD=
XDG_CACHE_HOME=/home/jovyan/.cache/
PROXY_PUBLIC_PORT_80_TCP_ADDR=10.107.76.62
NV_LIBNPP_DEV_VERSION=11.7.4.75-1
JUPYTER_IMAGE_SPEC=kkricksdsu/matlab-notebook:pulmonary-v1.4
MLM_LICENSE_FILE=1701@metztli.sdsu.edu
HUB_PORT_8081_TCP=tcp://10.106.178.160:8081
KMP_INIT_AT_FORK=false
JUPYTER_ENABLE_LAB=yes
NV_LIBCUSPARSE_DEV_VERSION=11.7.4.91-1
KMP_BLOCKTIME=1
PROXY_API_PORT=tcp://10.104.61.87:8001
LIBRARY_PATH=/usr/local/cuda/lib64/stubs
NV_CUDNN_VERSION=8.5.0.96
JUICE_VERSION=2023.01.22-1415.17613ca9
MWAPIKEY=866a373b-c07c-4f75-9a44-c6fc3f990fc3
MW_CD_ANYWHERE_DISABLED=false
ARCH=glnxa64
KMP_HANDLE_SIGNALS=0
JUPYTERHUB_OAUTH_ACCESS_SCOPES=["access:servers!server=kkrick@sdsu.edu/", "access:servers!user=kkrick@sdsu.edu"]
DISPLAY=:0
MWI_AUTH_TOKEN=a9tl4FvhLg6n3v4Nix7VQpeWwXOY7qqTWExsPKOvqcw
PROXY_API_PORT_8001_TCP_PROTO=tcp
SHLVL=0
CONDA_DIR=/opt/conda
NV_CUDA_LIB_VERSION=11.7.1-1
KMP_STACKSIZE=512k
NVARCH=x86_64
KUBERNETES_PORT_443_TCP_PROTO=tcp
JUPYTERHUB_API_URL=http://hub:8081/hub/api
JUPYTERHUB_CLIENT_ID=jupyterhub-user-kkrick%40sdsu.edu
PROXY_PUBLIC_PORT_80_TCP_PORT=80
JUPYTERHUB_OAUTH_SCOPES=["access:servers!server=kkrick@sdsu.edu/", "access:servers!user=kkrick@sdsu.edu"]
NV_CUDNN_PACKAGE_DEV=libcudnn8-dev=8.5.0.96-1+cuda11.7
KUBERNETES_PORT_443_TCP_ADDR=10.96.0.1
MW_CD_ANYWHERE_ENABLED=true
JUPYTERHUB_HOST=
NV_CUDA_COMPAT_PACKAGE=cuda-compat-11-7
ICU_TIMEZONE_FILES_DIR=/opt/matlab/bin/icutzdata
JUPYTER_PORT=8888
NV_LIBNCCL_PACKAGE=libnccl2=2.13.4-1+cuda11.7
LD_LIBRARY_PATH=/opt/matlab/sys/opengl/lib/glnxa64:/opt/matlab/sys/os/glnxa64:/opt/matlab/bin/glnxa64:/home/jovyan/.MathWorks/kVZeeiAY1Fr3ZovJjmsHEUBvAgAakzTeeDKf9XVMboA/bin/glnxa64:/opt/matlab/extern/lib/glnxa64:/opt/matlab/cefclient/sys/os/glnxa64:/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/opt/matlab/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/nvidia/lib:/usr/local/nvidia/lib64
HUB_SERVICE_PORT_HUB=8081
GIT_PYTHON_REFRESH=quiet
CPU_GUARANTEE=4.0
XFILESEARCHPATH=/opt/matlab/sys/java/jre/glnxa64/jre/lib/locale/%L/%T/%N%S:
NV_CUDA_NSIGHT_COMPUTE_VERSION=11.7.1-1
CPU_LIMIT=4.0
MWI_APP_HOST=127.0.0.1
MWI_APP_PORT=37055
NB_USER=jovyan
KUBERNETES_SERVICE_HOST=10.96.0.1
NV_NVPROF_VERSION=11.7.101-1
MWI_SHUTDOWN_ON_IDLE_TIMEOUT=20160
KUBERNETES_PORT=tcp://10.96.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
PROXY_API_PORT_8001_TCP=tcp://10.104.61.87:8001
PROXY_PUBLIC_SERVICE_PORT=80
HUB_PORT_8081_TCP_PORT=8081
PATH=/opt/pulmonarytoolkit/bin:/opt/conda/bin:/usr/local/nvidia/bin:/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HUB_PORT_8081_TCP_ADDR=10.106.178.160
NV_LIBNCCL_PACKAGE_NAME=libnccl2
HUB_PORT_8081_TCP_PROTO=tcp
HTTP_MATLAB_CLIENT_GATEWAY_PUBLIC_PORT=1
AUTOMOUNT_MAP=
NV_LIBNCCL_PACKAGE_VERSION=2.13.4-1
MKL_NUM_THREADS=
JUPYTERHUB_USER=kkrick@sdsu.edu
JUPYTERHUB_ACTIVITY_URL=http://hub:8081/hub/api/users/kkrick@sdsu.edu/activity
MATLAB_CONNECTOR_HOSTING_ENVIRONMENT=tmw
DEBIAN_FRONTEND=noninteractive
MEMKIND_HEAP_MANAGER=TBB
LC_NUMERIC=C
OLDPWD=/opt/matlab
_=/usr/bin/env
# Copyright 2021-2022 The MathWorks, Inc.
# Builds Docker image with
# 1. MATLAB - Using MPM
# 2. MATLAB Integration for Jupyter
# on a base image of jupyter/base-notebook.
## Sample Build Command:
# docker build --build-arg MATLAB_RELEASE=r2022a \
# --build-arg MATLAB_PRODUCT_LIST="MATLAB Deep_Learning_Toolbox Symbolic_Math_Toolbox"\
# --build-arg LICENSE_SERVER=12345@hostname.com \
# -t my_matlab_image_name .
# Specify release of MATLAB to build. (use lowercase, default is r2022a)
ARG MATLAB_RELEASE=r2023a
# Specify the list of products to install into MATLAB,
ARG MATLAB_PRODUCT_LIST="MATLAB Curve_Fitting_Toolbox Image_Processing_Toolbox Statistics_and_Machine_Learning_Toolbox"
# Optional Network License Server information
ARG LICENSE_SERVER
# If LICENSE_SERVER is provided then SHOULD_USE_LICENSE_SERVER will be set to "_use_lm"
ARG SHOULD_USE_LICENSE_SERVER=${LICENSE_SERVER:+"_with_lm"}
# Default DDUX information
ARG MW_CONTEXT_TAGS=MATLAB_PROXY:JUPYTER:MPM:V1
# # Base Jupyter image without LICENSE_SERVER
# FROM jupyter/base-notebook AS base_jupyter_image
# # Base Jupyter image with LICENSE_SERVER
# FROM jupyter/base-notebook AS base_jupyter_image_with_lm
ARG BASE_CONTAINER=gitlab-registry.nrp-nautilus.io/prp/jupyter-stack/scipy:v1.3
FROM $BASE_CONTAINER
ENV MLM_LICENSE_FILE=${LICENSE_SERVER}
# Select base Jupyter image based on whether LICENSE_SERVER is provided
#FROM base_jupyter_image${SHOULD_USE_LICENSE_SERVER}
ARG MW_CONTEXT_TAGS
ARG MATLAB_RELEASE
ARG MATLAB_PRODUCT_LIST
# Switch to root user
USER root
ENV DEBIAN_FRONTEND="noninteractive" TZ="Etc/UTC"
## Installing Dependencies for Ubuntu 20.04
# For MATLAB : Get base-dependencies.txt from matlab-deps repository on GitHub
# For mpm : wget, unzip, ca-certificates
# For MATLAB Integration for Jupyter : xvfb
# List of MATLAB Dependencies for Ubuntu 20.04 and specified MATLAB_RELEASE
ARG MATLAB_DEPS_REQUIREMENTS_FILE="https://raw.githubusercontent.com/mathworks-ref-arch/container-images/main/matlab-deps/${MATLAB_RELEASE}/ubuntu22.04/base-dependencies.txt"
ARG MATLAB_DEPS_REQUIREMENTS_FILE_NAME="matlab-deps-${MATLAB_RELEASE}-base-dependencies.txt"
# Install dependencies
RUN wget ${MATLAB_DEPS_REQUIREMENTS_FILE} -O ${MATLAB_DEPS_REQUIREMENTS_FILE_NAME} && \
export DEBIAN_FRONTEND=noninteractive && apt-get update && \
xargs -a ${MATLAB_DEPS_REQUIREMENTS_FILE_NAME} -r apt-get install --no-install-recommends -y \
wget \
unzip \
ca-certificates \
xvfb \
&& apt-get clean \
&& apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/*
# Run mpm to install MATLAB in the target location and delete the mpm installation afterwards
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm && \
chmod +x mpm && \
./mpm install \
--release=${MATLAB_RELEASE} \
--destination=/opt/matlab \
--products ${MATLAB_PRODUCT_LIST} && \
rm -f mpm /tmp/mathworks_root.log && \
ln -s /opt/matlab/bin/matlab /usr/local/bin/matlab
# # Install patched glibc - See https://github.com/mathworks/build-glibc-bz-19329-patch
# WORKDIR /packages
# RUN export DEBIAN_FRONTEND=noninteractive && \
# apt-get update && apt-get clean && apt-get autoremove && \
# wget -q https://github.com/mathworks/build-glibc-bz-19329-patch/releases/download/ubuntu-focal/all-packages.tar.gz && \
# tar -x -f all-packages.tar.gz \
# --exclude glibc-*.deb \
# --exclude libc6-dbg*.deb && \
# apt-get install --yes --no-install-recommends --allow-downgrades ./*.deb && \
# rm -fr /packages
WORKDIR /
# Optional: Install MATLAB Engine for Python, if possible.
# Note: Failure to install does not stop the build.
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update \
&& apt-get install --no-install-recommends -y python3-distutils \
&& apt-get clean \
&& apt-get -y autoremove \
&& rm -rf /var/lib/apt/lists/* \
&& cd /opt/matlab/extern/engines/python \
&& python setup.py install || true
# Install additional software in /opt/
WORKDIR /opt
# To-Do: This may not be needed with user-installed version
# Install Pulmonary Toolkit: https://github.com/tomdoel/pulmonarytoolkit
RUN git clone https://github.com/tomdoel/pulmonarytoolkit.git \
&& chown -R jovyan:users /opt/pulmonarytoolkit/
ENV PATH /opt/pulmonarytoolkit/bin:$PATH
# Install rclone
RUN curl https://rclone.org/install.sh | bash
# Install desktop OS dependencies
RUN apt-get -y update \
&& apt-get -y install \
icedtea-netx \
net-tools \
dbus-x11 \
firefox \
xfce4 \
xfce4-panel \
xfce4-session \
xfce4-settings \
xorg \
xubuntu-icon-theme \
tigervnc-standalone-server \
tigervnc-xorg-extension \
&& apt-get remove -y -q light-locker \
&& apt clean && rm -rf /var/lib/apt/lists/* \
&& fix-permissions "${CONDA_DIR}" \
&& fix-permissions "/home/${NB_USER}"
# Install NBIA Data Retriever https://wiki.cancerimagingarchive.net/display/NBIA/Downloading+TCIA+Images
RUN wget -O nbia-data-retriever-4.4.1.deb "https://cbiit-download.nci.nih.gov/nbia/releases/ForTCIA/NBIADataRetriever_4.4.1/nbia-data-retriever-4.4.1.deb" \
&& dpkg -i nbia-data-retriever-4.4.1.deb
RUN echo -e "jovyan ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
# Switch back to notebook user
USER $NB_USER
WORKDIR /home/${NB_USER}
# Install MATLAB integration
RUN python -m pip install jupyter-matlab-proxy matlab_kernel
# Ensure jupyter-server-proxy JupyterLab extension is installed
#RUN jupyter labextension install @jupyterlab/server-proxy
# Install Jupyter Desktop
RUN /opt/conda/bin/conda install -c manics websockify
RUN pip install jupyter-remote-desktop-proxy
# Make JupyterLab the default environment
ENV JUPYTER_ENABLE_LAB="yes"
ENV MW_CONTEXT_TAGS=${MW_CONTEXT_TAGS}
# Set timeout to 2 weeks
ENV MWI_SHUTDOWN_ON_IDLE_TIMEOUT=20160
Thank you @kkrick-sdsu !
The environment variable MWI_SHUTDOWN_ON_IDLE_TIMEOUT
is not designed to cater to this case, so might be inconsequential to the issue being reported.
A few more followup questions to help investigate the issue:
Does MATLAB crash? or exit unexpectedly? Are there any crash logs that you can find?
Is the Jupyter Lab instance still running? Have you configured any kind of cullers at the Jupyter level ?
Does the researcher start a Jupyter notebook, or directly use the MATLAB IDE from the Jupyter Lab interface?
Does this issue only arise with a particular kind of script or happens with all long running scripts?
Does the MATLAB instance consistently go away exactly at the 2 hour mark, or is it variable ?
Are there any Jupyter Server logs that you have access to that you could share ?
Hi @prabhakk-mw ,
Thanks, Kyle
Thank you @kkrick-sdsu
"Either this integration terminated or the session ended".
This implies that the underlying webserver process ( ie: matlab-proxy-app
) itself has been terminated. This could either because it crashed or that it was culled.
I don't think that this is because of MATLAB crashing, its most likely because something caused matlab-proxy-app
to be terminated which in turn terminates the MATLAB child process.
@kkrick-sdsu Any luck with finding the logs from Jupyter?
Hi @prabhakk-mw
No, I have not. I think we can close this issue as I don't have a way to reproduce in my own environment to get those logs.
-Kyle
Thank you for your response @kkrick-sdsu
In case your user is still facing this issue, and would like our assistance kindly direct him to create a service request using the link below:
Referring to this issue should have him routed to the right teams.
Is it possible to set the session timeout when using MATLAB in a browser?
It would appear that this is using MATLAB Online which supports configuration for session timeouts but I have not been able to find the file specified.
I am using the MATLAB Integration for Jupyter in a Docker Container.
Thanks!