Skip to content

Commit ada56b4

Browse files
Ensure Jupyterlab container healthchecks don't fail because of leftover files (#607)
## Overview Leftover files from Jupyterlab containers that didn't shut down properly could cause the healthcheck to always fail. Old files are now removed when the container starts up so this is avoided. The full explanation: If a Jupyterlab container is not shut down properly then it does not have a chance to [clean up](https://github.com/jupyter-server/jupyter_server/blob/dd435c/jupyter_server/serverapp.py#L3152) old runtime files. These runtime files are stored in the user's home directory which is persisted between containers as a bind-mount. When the Jupyterlab container is created again, it will create new versions of some of these files. One of which is the jpserver JSON files which contains [a URL used by the healthchecks](https://github.com/jupyter/docker-stacks/blob/3b8a79/images/base-notebook/docker_healthcheck.py#L27). This URL contains the hostname of the Jupyterlab container which is different each time a new container is created. Different files will have different hostnames, only one of which will be the hostname for the current container. Since the [healthchecks](https://github.com/jupyter/docker-stacks/blob/3b8a79/images/base-notebook/docker_healthcheck.py#L27) use `glob` which returns files in an arbitrary order, the healthcheck can easily choose an old file with an old hostname. If that is the case, the healthcheck will always fail. ## Changes **Non-breaking changes** - bugfix **Breaking changes** - None ## Related Issue / Discussion ## Additional Information ## CI Operations <!-- The test suite can be run using a different DACCS config with ``birdhouse_daccs_configs_branch: branch_name`` in the PR description. To globally skip the test suite regardless of the commit message use ``birdhouse_skip_ci`` set to ``true`` in the PR description. Using ``[<cmd>]`` (with the brackets) where ``<cmd> = skip ci`` in the commit message will override ``birdhouse_skip_ci`` from the PR description. Such commit command can be used to override the PR description behavior for a specific commit update. However, a commit message cannot 'force run' a PR which the description turns off the CI. To run the CI, the PR should instead be updated with a ``true`` value, and a running message can be posted in following PR comments to trigger tests once again. --> birdhouse_daccs_configs_branch: master birdhouse_skip_ci: false
2 parents ecd419e + 2e1e470 commit ada56b4

File tree

8 files changed

+47
-14
lines changed

8 files changed

+47
-14
lines changed

.bumpversion.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tool.bumpversion]
2-
current_version = "2.18.13"
2+
current_version = "2.18.14"
33
commit = true
44
tag = false
55
tag_name = "{new_version}"

CHANGES.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,35 @@
1717

1818
[//]: # (list changes here, using '-' for each new entry, remove this when items are added)
1919

20+
[2.18.14](https://github.com/bird-house/birdhouse-deploy/tree/2.18.14) (2025-12-01)
21+
------------------------------------------------------------------------------------------------------------------
22+
23+
## Fixes
24+
25+
- Ensure Jupyterlab container healthchecks don't fail because of leftover files
26+
27+
Leftover files from Jupyterlab containers that didn't shut down properly could cause the
28+
healthcheck to always fail. Old files are now removed when the container starts up so this is avoided.
29+
30+
The full explanation:
31+
32+
If a Jupyterlab container is not shut down properly then it does not have a chance to
33+
[clean up](https://github.com/jupyter-server/jupyter_server/blob/dd435c/jupyter_server/serverapp.py#L3152)
34+
old runtime files. These runtime files are stored in the user's home directory which is
35+
persisted between containers as a bind-mount.
36+
37+
When the Jupyterlab container is created again, it will create new versions of some of these files. One of which
38+
is the jpserver JSON files which contains [a URL used by the
39+
healthchecks](https://github.com/jupyter/docker-stacks/blob/3b8a79/images/base-notebook/docker_healthcheck.py#L27).
40+
41+
This URL contains the hostname of the Jupyterlab container which is different each time a new container is created.
42+
Different files will have different hostnames, only one of which will be the hostname for the current container.
43+
44+
Since the [healthchecks](https://github.com/jupyter/docker-stacks/blob/3b8a79/images/base-notebook/docker_healthcheck.py#L27)
45+
use `glob` which returns files in an arbitrary order, the healthcheck can easily choose an old file with an old hostname.
46+
If that is the case, the healthcheck will always fail.
47+
48+
2049
[2.18.13](https://github.com/bird-house/birdhouse-deploy/tree/2.18.13) (2025-12-01)
2150
------------------------------------------------------------------------------------------------------------------
2251

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ override BIRDHOUSE_MAKE_DIR := $(shell realpath -P $$(dirname $(BIRDHOUSE_MAKE_C
88
# Generic variables
99
override SHELL := bash
1010
override APP_NAME := birdhouse-deploy
11-
override APP_VERSION := 2.18.13
11+
override APP_VERSION := 2.18.14
1212

1313
# utility to remove comments after value of an option variable
1414
override clean_opt = $(shell echo "$(1)" | $(_SED) -r -e "s/[ '$'\t'']+$$//g")

README.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ for a full-fledged production platform.
1818
* - citation
1919
- | |citation|
2020

21-
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.18.13.svg
21+
.. |commits-since| image:: https://img.shields.io/github/commits-since/bird-house/birdhouse-deploy/2.18.14.svg
2222
:alt: Commits since latest release
23-
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.18.13...master
23+
:target: https://github.com/bird-house/birdhouse-deploy/compare/2.18.14...master
2424

25-
.. |latest-version| image:: https://img.shields.io/badge/tag-2.18.13-blue.svg?style=flat
25+
.. |latest-version| image:: https://img.shields.io/badge/tag-2.18.14-blue.svg?style=flat
2626
:alt: Latest Tag
27-
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.18.13
27+
:target: https://github.com/bird-house/birdhouse-deploy/tree/2.18.14
2828

2929
.. |readthedocs| image:: https://readthedocs.org/projects/birdhouse-deploy/badge/?version=latest
3030
:alt: ReadTheDocs Build Status (latest version)

RELEASE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.18.13 2025-12-01T15:35:01Z
1+
2.18.14 2025-12-01T15:42:49Z

birdhouse/components/canarie-api/docker_configuration.py.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ SERVICES = {
108108
# NOTE:
109109
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
110110
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
111-
'version': '2.18.13',
112-
'releaseTime': '2025-12-01T15:35:01Z',
111+
'version': '2.18.14',
112+
'releaseTime': '2025-12-01T15:42:49Z',
113113
'institution': '${BIRDHOUSE_INSTITUTION}',
114114
'researchSubject': '${BIRDHOUSE_SUBJECT}',
115115
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',
@@ -141,8 +141,8 @@ PLATFORMS = {
141141
# NOTE:
142142
# Below version and release time auto-managed by 'make VERSION=x.y.z bump'.
143143
# Do NOT modify it manually. See 'Tagging policy' in 'birdhouse/README.rst'.
144-
'version': '2.18.13',
145-
'releaseTime': '2025-12-01T15:35:01Z',
144+
'version': '2.18.14',
145+
'releaseTime': '2025-12-01T15:42:49Z',
146146
'institution': '${BIRDHOUSE_INSTITUTION}',
147147
'researchSubject': '${BIRDHOUSE_SUBJECT}',
148148
'supportEmail': '${BIRDHOUSE_SUPPORT_EMAIL}',

birdhouse/components/jupyterhub/jupyterhub_config.py.template

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,14 @@ if jupyter_idle_server_cull_timeout or jupyter_idle_kernel_cull_timeout:
295295
# It also makes a symlink between the kernels directory in the user space to another
296296
# location outside of the home directory. This is because jupyterlab is currently unable
297297
# to detect kernels inside the user's home directory for some reason.
298+
# This also removes any old server metadata files which may not be cleaned up if the container
299+
# exits unexpectedly. This is necessary to ensure that the healthcheck can detect the correct
300+
# hostname of the jupyterlab server (this changes every time a new container is created).
298301
_post_start_command = (
299302
"ln -s $HOME/.local /home/$NB_USER/.local; "
300303
f"mkdir -p {user_kernels_dir}; "
301-
f"ln -s $HOME/.local/share/jupyter/kernels {user_kernels_dir}/kernels"
304+
f"ln -s $HOME/.local/share/jupyter/kernels {user_kernels_dir}/kernels; "
305+
"rm $HOME/.local/share/jupyter/runtime/jpserver-*.json"
302306
)
303307
c.DockerSpawner.post_start_cmd = f"sh -c '{_post_start_command}'"
304308

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@
6969
# built documents.
7070
#
7171
# The short X.Y version.
72-
version = '2.18.13'
72+
version = '2.18.14'
7373
# The full version, including alpha/beta/rc tags.
74-
release = '2.18.13'
74+
release = '2.18.14'
7575

7676
# The language for content autogenerated by Sphinx. Refer to documentation
7777
# for a list of supported languages.

0 commit comments

Comments
 (0)