Subject: bug#42797: starting thread from an used module dead lock

From: Michal Herko <[email-masked]>
Date: Mon, 10 Aug 2020 11:57:51 +0200

Hello,
Attempint to start a new thread from a file loaded using *use-modules*
dead locks guile.

Create a file *start.scm*

```
(define-module (start))

(use-modules
  (ice-9 threads))

(call-with-new-thread
  (lambda ()
    (format #t "hello from thread\n")))
```

Create a file *use.scm*

```
(define-module (use))

(use-modules (start))
```

Execute start.scm:

    $ guile -L . start.scm

The program should print the message end exit.
Instead it would hang forever without using cpu.
The bug displays both on guile version 2.2.7 and 3.0.4.
I was testing on debian bullseye, x86_64.
The workaround is to use *load-from-path* instead of *use-modules*.
The bug does not manifest from REPL.