# Test involving thread spawning failed in GitHub Actions

**URL:** <https://discourse.julialang.org/t/test-involving-thread-spawning-failed-in-github-actions/74731>\
**Category:** General Usage\
**Tags:** testing, github-actions\
**Created:** [January 17, 2022, 5:19am UTC](https://discourse.julialang.org/t/test-involving-thread-spawning-failed-in-github-actions/74731 "2022-01-17T05:19:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucifer1004](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lucifer1004/32/22311_2.png) [@lucifer1004](https://discourse.julialang.org/u/lucifer1004)\
**Post date:** [January 17, 2022, 5:19am UTC](https://discourse.julialang.org/t/test-involving-thread-spawning-failed-in-github-actions/74731/1 "2022-01-17T05:19:15Z")

</div>

There is a test in my testset involving thread spawning.

```julia
@test begin
...
      repl_closed = Condition()
      start_repl() = begin
        m.start_repl(; output = output)
        notify(repl_closed)
      end
      repl_handle = Threads.@spawn start_repl()
      sleep(1)
      schedule(repl_handle, ErrorException(""), error = true)
...

```

In the code, `m.start_repl()` starts a while loop which keeps waiting for `readline()`.

When I ran it locally (both ubuntu 20.04 and MacOS 12), it could pass. However, it kept failing in GitHub Actions, yielding `Task not runnable` exception.

The strangest part was that when I took control of the CI environment throw the `tmate` action, and ran the exactly same test script `julia --color=yes --project=. -t 1 -e 'import Pkg; Pkg.test(; coverage=true)'`, it could pass.

P.S. I have tried many different thread settings (empty / 1 / 2 / 4 / “auto”), and none worked.

---

<div class="post-metadata">

**Author:** ![lucifer1004](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lucifer1004/32/22311_2.png) [@lucifer1004](https://discourse.julialang.org/u/lucifer1004)\
**Post date:** [January 17, 2022, 5:21am UTC](https://discourse.julialang.org/t/test-involving-thread-spawning-failed-in-github-actions/74731/2 "2022-01-17T05:21:36Z")

</div>

I have found the cause. It was because when the test was running via GitHub Actions, `readline()` from `stdin` worked differently as in a shell environment.
