Calling a function breaks REPL in Juno -- ERROR: unlock from wrong thread

Running the code below in Juno renders the REPL broken, and by that I mean I can no longer run anything from the REPL. I’m trying to do more than just a simple wrapper function, but the code below was the minimum needed to reproduce the error.

using GeoArrays

function read_raster(path)
    a = GeoArrays.read(path)
    a
end

read_raster("test/input/some_raster.asc")

where "test/input/some_raster.asc" is a file on my local system. Once I run the above, running 2+2 from the REPL does not produce any output (it just hangs) and pressing ctrl-c to interrupt it results in the following:

julia> 2+2
^CERROR: InterruptException:
Stacktrace:
 [1] poptaskref(::Base.InvasiveLinkedListSynchronized{Task}) at ./task.jl:702
 [2] wait() at ./task.jl:709
 [3] wait(::Base.GenericCondition{Base.Threads.SpinLock}) at ./condition.jl:106
 [4] lock(::ReentrantLock) at ./lock.jl:80
 [5] evalrepl(::Module, ::String) at /root/.julia/packages/Atom/cYxbS/src/repl.jl:221
 [6] top-level scope at /root/.julia/packages/Atom/cYxbS/src/repl.jl:272
 [7] eval(::Module, ::Any) at ./boot.jl:331
 [8] eval_user_input(::Any, ::REPL.REPLBackend) at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:86
 [9] macro expansion at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.4/REPL/src/REPL.jl:118 [inlined]
 [10] (::REPL.var"#26#27"{REPL.REPLBackend})() at ./task.jl:358
ERROR: unlock from wrong thread
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] unlock(::ReentrantLock) at ./lock.jl:101
 [3] evalrepl(::Module, ::String) at /root/.julia/packages/Atom/cYxbS/src/repl.jl:251
 [4] top-level scope at /root/.julia/packages/Atom/cYxbS/src/repl.jl:272

Also of note – neither this:

using GeoArrays

function read_raster(path)
    a = GeoArrays.read(path)
    a.A
end

read_raster("test/input/temperature.asc")

nor this

using GeoArrays
a = GeoArrays.read(path)

cause the same error.

I tried removing then installing uber-juno and julia-client in atom but that didn’t help.

I wasn’t sure if this should be posted as an issue in the either the Juno or Julia repo – I thought the discourse might be a good place to start.

Here’s my version info:

julia> versioninfo()
Julia Version 1.4.0-rc2.0
Commit b99ed72c95 (2020-02-24 16:51 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Xeon(R) E-2176M  CPU @ 2.70GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-8.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 11
  JULIA_EDITOR = atom  -a

P.S. I’m working in a Docker image, so it should be possible to replicate this issue on any system.

1 Like

Can you upload that file here for testing purposes?

Here’s a link to the file on github.

And FWIW, here’s the Dockerfile:

# Dockerfile written by Vincent Landau
# Built upon jamesnetherton's atom Dockerfile (here: 
# https://hub.docker.com/r/jamesnetherton/docker-atom-editor/dockerfile) 

FROM ubuntu:18.04

ENV ATOM_VERSION v1.41.0

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
      ca-certificates \
      curl \
      fakeroot \
      gconf2 \
      gconf-service \
      git \
      policykit-1 \
      gvfs-bin \
      libasound2 \
      libcap2 \
      libgconf-2-4 \
      libgcrypt20 \
      libgtk2.0-0 \
      libgtk-3-0 \
      libnotify4 \
      libnss3 \
      libx11-xcb1 \
      libxkbfile1 \
      libxss1 \
      libxtst6 \
      libgl1-mesa-glx \
      libgl1-mesa-dri \
      python \
      xdg-utils --no-install-recommends && \
    apt-get clean && \
    rm -rf /var/lib/apt/lists/* && \
    curl -L https://github.com/atom/atom/releases/download/${ATOM_VERSION}/atom-amd64.deb > /tmp/atom.deb && \
    dpkg -i /tmp/atom.deb && \
    rm -f /tmp/atom.deb

# Install julia
RUN curl -L https://julialang-s3.julialang.org/bin/linux/x64/1.4/julia-1.4.0-rc2-linux-x86_64.tar.gz > /tmp/julia.tar.gz
RUN tar -zxvf /tmp/julia.tar.gz
RUN ln -s /julia-1.4.0-rc2/bin/julia /usr/bin/julia

RUN apm install uber-juno

# Install julia packages so they don't need to be 
# install from stratch when Julia is started in Atom
RUN julia -e 'using Pkg; Pkg.add("GeoArrays")'

RUN julia -e 'using Pkg; Pkg.add(["Juno","Atom"])'

# Install Circuitscape and dependencies

RUN apt-get update && apt-get install -y zlib1g-dev
RUN julia -e 'using Pkg; Pkg.add(["Circuitscape", "BenchmarkTools"])'

CMD ["/usr/bin/atom","-f"]

I share my display on Linux with Docker so Atom can be launched on my desktop:

xhost local:root
docker run -i -d --rm --ipc "host" -v /tmp/.X11-unix/:/tmp/.X11-unix/ \
              	   -v $HOME/.atom:/root/.atom \
              	   -v "$(pwd)":/home/omniscape \
              	   -e DISPLAY \
              	   -e JULIA_NUM_THREADS=4 \
              	   vlandau/juno:1.4.0-rc2

May be related to JunoLab/Juno.jl/issues/501. I posted a comment there.

This was fixed with JunoLab/Atom.jl/pull/300 and the patch was released in Atom.jl v0.12.10