Stream: Mirror: Isabelle Development Mailing List

Topic: Timeout.apply not interrupting in a forked thread (since ...


view this post on Zulip Email Gateway (Nov 14 2026 at 14:52):

From: Kevin Kappelmann via isabelle-dev <isabelle-dev@proof.cit.tum.de>
Subject: Timeout.apply not interrupting in a forked thread (since 86049:b6e33c2b52c9)

Hi all,

since 86049:b6e33c2b52c9 (10.11.2026), Timeout.apply no longer
interrupts Future.join in a forked thread. An example is attached below.

Best wishes,

Kevin

isabelle
theory Scratch
imports Pure
begin

ML \<open>
val start = Time.now ()
val _ = Isabelle_Thread.join (Isabelle_Thread.fork
(Isabelle_Thread.params "test" |> Isabelle_Thread.interrupts) (fn () =>
Timeout.apply (seconds 1.0) (fn () =>
Future.join (Future.fork (fn () => Time.sleep (seconds 5.0)))) ()
handle Timeout.TIMEOUT _ => ()))
val _ = writeln (Time.toString (Time.now () - start))
\<close>

end

view this post on Zulip Email Gateway (Nov 14 2026 at 22:23):

From: Makarius <makarius@sketis.net>
Subject: Timeout.apply not interrupting in a forked thread (since 86049:b6e33c2b52c9)

On 14/11/2026 15:51, Kevin Kappelmann via isabelle-dev wrote:

since 86049:b6e33c2b52c9 (10.11.2026), Timeout.apply no longer interrupts
Future.join in a forked thread.
Thanks for the hint. There was another spot where interrupts were missing. See
now these changesets:

changeset: 86095:0f620b9c12f5
user: wenzelm
date: Sat Nov 14 19:58:08 2026 +0100
files: src/Pure/Concurrent/future.ML
description:
proper interrupts for Future.join and the scheduler thread (amending
b6e33c2b52c9);

changeset: 86094:20ae53370ed1
user: wenzelm
date: Sat Nov 14 19:31:23 2026 +0100
files: src/Pure/Concurrent/future.ML
src/Pure/Concurrent/multithreading.ML src/Pure/Concurrent/single_assignment.ML
src/Pure/Concurrent/syn
chronized.ML src/Pure/Concurrent/task_queue.ML src/Tools/Metis/make_metis
src/Tools/Metis/metis.ML
description:
clarified names, to emphasize the semantics better (see b6e33c2b52c9);

Makarius

view this post on Zulip Email Gateway (Nov 25 2026 at 18:21):

From: Kevin Kappelmann via isabelle-dev <isabelle-dev@proof.cit.tum.de>
Subject: Timeout.apply not interrupting in a forked thread (since 86049:b6e33c2b52c9)

Hi Makarius,

Thanks for the quick response! Unfortunately, the example from my
original mail still does not work. I checked with 86203:c929a2c01c20

Best wishes,

Kevin

On 14.11.26 23:22, Makarius wrote:

On 14/11/2026 15:51, Kevin Kappelmann via isabelle-dev wrote:

since 86049:b6e33c2b52c9 (10.11.2026), Timeout.apply no longer
interrupts Future.join in a forked thread.
Thanks for the hint. There was another spot where interrupts were
missing. See now these changesets:

changeset:   86095:0f620b9c12f5
user:        wenzelm
date:        Sat Nov 14 19:58:08 2026 +0100
files:       src/Pure/Concurrent/future.ML
description:
proper interrupts for Future.join and the scheduler thread (amending
b6e33c2b52c9);

changeset:   86094:20ae53370ed1
user:        wenzelm
date:        Sat Nov 14 19:31:23 2026 +0100
files:       src/Pure/Concurrent/future.ML src/Pure/Concurrent/
multithreading.ML src/Pure/Concurrent/single_assignment.ML src/Pure/
Concurrent/syn
chronized.ML src/Pure/Concurrent/task_queue.ML src/Tools/Metis/
make_metis src/Tools/Metis/metis.ML
description:
clarified names, to emphasize the semantics better (see b6e33c2b52c9);

Makarius

view this post on Zulip Email Gateway (Nov 28 2026 at 23:14):

From: Kevin Kappelmann via isabelle-dev <isabelle-dev@proof.cit.tum.de>
Subject: Timeout.apply not interrupting in a forked thread (since 86049:b6e33c2b52c9)

Hi Makarius,

Thanks! I stumbled upon this when using PARALLEL_CHOICE in a Mirabelle
action. Actions did not time out despite passing a timeout. I can
confirm that it works now.

PS. When pressing "reply" to your email, it suggested to reply to
"isabelle-dev@proof.cit.tum.de". I then received a "Undelivered Mail
Returned to Sender" stating:


The mail system

<isabelle-dev@proof.cit.tum.de>: host
mailrelay.rbg.tum.de[2a09:80c0:254::10]
said: 550 5.1.1 <isabelle-dev@proof.cit.tum.de>: Recipient address
rejected: User unknown (in reply to RCPT TO command)


Replying to isabelle-dev@mailman.proof.cit.tum.de instead works for me.

Best wishes,

Kevin

On 28.11.26 20:28, Makarius wrote:

On 25/11/2026 19:20, Kevin Kappelmann via isabelle-dev wrote:

Thanks for the quick response! Unfortunately, the example from my
original mail still does not work. I checked with 86203:c929a2c01c20

I have made some more rounds of refinements, including this notable change:

changeset:   86254:8cf526d4e75f
user:        wenzelm
date:        Fri Nov 27 21:31:59 2026 +0100
files:       src/Pure/Concurrent/single_assignment.ML src/Pure/
Concurrent/synchronized.ML
description:
proper interrupts for Single_Assignment.await and
Synchronized.timed_access (amending b6e33c2b52c9);

Originally, I did not look sufficiently close at your example --- merely
at the implementation of Future.join.

Your example is unusual in using its own Isabelle_Thread.fork: this is
normally for system infrastructure only. The canonical way for Isabelle/
ML user programs is Future.fork, which is subject to certain policies of
"worker" threads.

Outside of a worker thread, the meaning of a few operations is
different, notably Future.join: it does not really "join" into the other
computation, but waits passively until that is finished.

Sledgehammer is an exception: it stems from a time when the Future
module did not yet exist, and forking threads in Isabelle/ML was done in
a wild and uncontrolled manner.

Can you say a bit more about the canonical questions: "What is your
application? What are you trying to do?"

Was that just a problem with Sledgehammer, or something else?

Makarius


Last updated: Dec 02 2026 at 13:38 UTC