posit-dev / posit-dev/ark

Ark Kernel Fails to Connect

Open
#862 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
337
Forks
32
Avg merge
8d 17h
Merged PRs (30d)
11

Description

I am encountering an issue where the Ark kernel fails to establish a connection within a Windows-based Docker container running JupyterLab. I am able to successfully run R code using IRkernel in the same environment, but Ark consistently exhibits connection failures.

Environment

Docker Version: 28.1.1
Base Image: mcr.microsoft.com/windows/server:ltsc2022

JupyterLab Version: 4.4.3
Conda Version: py311_25.5.1-0

R Version: 4.5.1
Ark Version: 0.1.195
IRkernel Version: 1.3.2

Logs

[W 2025-06-30 15:49:02.525 ServerApp] Nudge: attempt 120 on kernel 339b791d-abc8-4cfa-8db3-4e1aab3d613d
[E 2025-06-30 15:49:02.844 ServerApp] Uncaught exception GET /api/kernels/339b791d-abc8-4cfa-8db3-4e1aab3d613d/channels?session_id=233900e2-03a1-47d3-aae5-f4bc8ab0630b (10.14.52.63)
    HTTPServerRequest(protocol='http', host='<host>:1234', method='GET', uri='/api/kernels/339b791d-abc8-4cfa-8db3-4e1aab3d613d/channels?session_id=233900e2-03a1-47d3-aae5-f4bc8ab0630b', version='HTTP/1.1', remote_ip='10.14.52.63')
    Traceback (most recent call last):
      File "C:\Miniconda3\Lib\site-packages\tornado\websocket.py", line 967, in _accept_connection
        await open_result
      File "C:\Miniconda3\Lib\site-packages\jupyter_server\services\kernels\websocket.py", line 75, in open
        await self.connection.connect()
    TimeoutError: Timeout
[W 2025-06-30 15:49:02.868 ServerApp] Timeout waiting for kernel_info reply from 339b791d-abc8-4cfa-8db3-4e1aab3d613d
[I 2025-06-30 15:49:02.869 ServerApp] Connecting to kernel 339b791d-abc8-4cfa-8db3-4e1aab3d613d.
  2025-06-30T22:49:02.874131Z ERROR  Received subscription message, but no `subscription_tx` is available to confirm on. Have we already received a subscription message once before?
    at crates\amalthea\src\socket\iopub.rs:283

[W 2025-06-30 15:49:02.913 ServerApp] Replacing stale connection: 339b791d-abc8-4cfa-8db3-4e1aab3d613d:233900e2-03a1-47d3-aae5-f4bc8ab0630b
[W 2025-06-30 15:49:07.414 ServerApp] Nudge: attempt 10 on kernel 339b791d-abc8-4cfa-8db3-4e1aab3d613d

... repeats

Steps to Reproduce

FROM mcr.microsoft.com/windows/server:ltsc2022

# Install miniconda
RUN powershell Invoke-WebRequest -Uri https://repo.anaconda.com/miniconda/Miniconda3-py311_25.5.1-0-Windows-x86_64.exe -OutFile MinicondaInstaller.exe
RUN powershell Start-Process -FilePath MinicondaInstaller.exe -ArgumentList '/InstallationType=AllUsers','/RegisterPython=0','/S','/D=C:\Miniconda3' -NoNewWindow -Wait
RUN powershell Remove-Item -Force MinicondaInstaller.exe
RUN powershell -Command "[Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\Miniconda3;C:\Miniconda3\Scripts;C:\Miniconda3\condabin', 'Machine')"

RUN conda install jupyterlab -y
RUN ipython profile create

# Install R
RUN powershell Invoke-WebRequest -OutFile R-4.5.1-win.exe https://cran.r-project.org/bin/windows/base/R-4.5.1-win.exe
RUN R-4.5.1-win.exe /SILENT /DIR="C:\Program Files\R\R-4.5.1" && powershell Remove-Item "R-4.5.1-win.exe"
RUN powershell -Command "[Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\Program Files\R\R-4.5.1\bin', 'User')"
RUN powershell -Command "[Environment]::SetEnvironmentVariable('R_HOME', 'C:\Program Files\R\R-4.5.1', 'User')"

# Install Ark
RUN powershell Invoke-WebRequest -OutFile ark.zip https://github.com/posit-dev/ark/releases/download/0.1.195/ark-0.1.195-windows-x64.zip
RUN powershell Expand-Archive -Path "ark.zip" -DestinationPath "C:\ark" && powershell Remove-Item "ark.zip"
RUN powershell -Command "[Environment]::SetEnvironmentVariable('Path', $env:Path + ';C:\ark', 'User')"
RUN ark --install

# Install IRkernel
RUN Rscript --no-save --no-restore -e "install.packages('IRkernel', repos='https://cloud.r-project.org'); IRkernel::installspec()"

ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--port=1234", "--allow-root"]
  1. Build Image
docker build -t <name> Dockerfile .
  1. Run container
docker run --rm -p 1234:1234 -it <name>
  1. Open URL and select Ark kernel.

  2. Attempt to run any R code.

cc @josiahparry

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure using the provided Dockerfile and Ark 0.1.195 setup, then inspect the subscription handling at crates\amalthea\src\socket\iopub.rs. Compare the Ark kernel connection behavior with the working IRkernel setup and trace the repeated timeout. Done means Ark connects in the Windows container and can execute R code without the kernel_info or subscription errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, jupyter, r, rust
Domain
backend, devtools, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.