coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Gabriel Scherer <gabriel.scherer AT gmail.com>
- To: Coq Club <coq-club AT inria.fr>
- Cc: Burak Ekici <ekcburak AT hotmail.com>, Łukasz Czajka <lukaszcz AT mimuw.edu.pl>
- Subject: Re: [Coq-Club] set_timeout in 8.8.0
- Date: Mon, 7 May 2018 11:41:36 +0200
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=gabriel.scherer AT gmail.com; spf=Pass smtp.mailfrom=gabriel.scherer AT gmail.com; spf=None smtp.helo=postmaster AT mail-qk0-f172.google.com
- Ironport-phdr: 9a23:1HdZshbGAXn2FNbbtGQwSxT/LSx+4OfEezUN459isYplN5qZr8S/bnLW6fgltlLVR4KTs6sC17KN9fi4EUU7or+5+EgYd5JNUxJXwe43pCcHRPC/NEvgMfTxZDY7FskRHHVs/nW8LFQHUJ2mPw6arXK99yMdFQviPgRpOOv1BpTSj8Oq3Oyu5pHfeQpFiCazbL9oMBm6sRjau9ULj4dlNqs/0AbCrGFSe+RRy2NoJFaTkAj568yt4pNt8Dletuw4+cJYXqr0Y6o3TbpDDDQ7KG81/9HktQPCTQSU+HQRVHgdnwdSDAjE6BH6WYrxsjf/u+Fg1iSWIdH6QLYpUjm58axlVAHnhzsGNz4h8WHYlMpwjL5AoBm8oxBz2pPYbJ2JOPZ7eK7WYNEUSndbXstJVSNBDIOyYYUMAeQcI+hXs4bzqkASrRunHwSgGP/jxiNKi3LwwKY00/4hEQbD3AE4HtwBqm/brM/0NKgMVeC+0bTGwinDb/xIwzfy9pLIeQ0mrPGDR71/atDRyUgxGAPBlFmQspDqPzOL2eQXrWeb9fFtVe2qi2E9qgFxpiKjydsrionMn48YzE3P+yt+wIYwP9K4SUh7bMalEJtWrSGaNpF5TtksQ2FyoCo10LkGtoShfCgP0pgnxgLfZ+SCc4eS7RPjVeORLS15hHJjZLKznQyy8VW4xu3zV8m0zFZKrjdendXWqn8N0BnT586aQfV+5keswSiD2xzX5+1eIk05lbDXJ4A/zrIsjJYfrEbOEjHwlU7rlqGZbF8k9fKt6+n/YrXpuJucN4hshwH7KKsum8i/Df0hMggNQ2SX4Oq82KDh8EHnWrlKgfo2kq7WsJDeO8sXvLK2AwhQ0oo76ha/CSmp0MgAkHUZMF5IfAiLgovpNl3UPvz0E+uzj06xnDpp2fzKJrjhDY/MLnjHnrfhZ7F960tExQo8199Q/IhUCrAfL/L3QEPxr8DXDh8nPAyu3ennEs5w1owbWW2VA6+ZNLnevkOP5uIqO+WMfpMauC7hK/g54P7jlWM2mVgEfaWwwZQXbG24Ee99LkWCYXvsh88BHn0Qsgo/SuzqklyCXiRJa3a8RaJvrg08XamhFM/oQp2nyOiK2z7+FZlLbEhHDEqNGDHmbdPXde0LbXe9K8V7kzEAHYOqS4I72Avm4ADzwaBmI+6S4SYYuIjuzvB64uTSkVc58jkiXJfV6H2EU2whxjBAfDQxxq0q5BUlkg7Sg5g9uORREJlo390MVw47MZDGyOkjUoL9XwvAepGCT1P0G4z6UwF0dco4xpo1W2g4A8+r10mR0C+jArtTnLuOVsRtr/DsmkPpLsM48E7okaksi158HJlKPGyiw7d8r03dXtGT1UqekKmueOIX2yufrGo=
If you believe there is a bug in the OCaml runtime, have you reported
an issue on the OCaml bugtracker ( http://caml.inria.fr/mantis/ )? I
haven't found any related issue.
After looking at this out of curiosity, I don't think that "Coq's
timeout function is broken because of a bug in the OCaml runtime" is a
fair description of the situation.
My understanding of Coq's lib/control.ml code (
https://github.com/coq/coq/blob/629fbc7/lib/control.ml ) is that there
are two timeout functions, one for Windows, which spins a separate
timer thread, and one for Linux which uses Unix.alarm. It seems
generally well-known¹ that, following POSIX, "alarm" is process-level
and may deliver the SIGALRM signal to any thread² that does not
explicity block it -- I don't think the OCaml runtime is supposed to
give any stronger guarantees than POSIX on these system calls.
¹: See for example http://maxim.int.ru/bookshelf/PthreadsProgram/htm/r_40.html
²: In that respect the "Management of signals" paragraph in the OCaml
manual ( http://caml.inria.fr/pub/docs/manual-ocaml/libref/Thread.html
) might be misleading; it talks about synchronous signals, and maybe
it is not clear that alarms are an "external" signal.
My non-expert understanding would thus be that Coq's signal-based
timeout implementation is not actually reliable for multi-threaded
usage, and that maybe the Coq developers could consider using the
thread-based implementation (currently Windows-only) more often. Does
it impact the performance in an important way? (It may also be
possible to use a signal-based implementation by ensuring that all
threads block the SIGALRM signal by default, and only unblocking the
signal before calling "timeout"; this requires using a mutex to
protect "timeout" calls, although it is possible to revert to the
thread-based implementation when the mutex is held by another thread
instead of blocking.)
On Thu, May 3, 2018 at 12:27 PM, Łukasz Czajka
<lukaszcz AT mimuw.edu.pl>
wrote:
> Hi.
>
> Our usecase is that Coq's timeout function is broken because of a bug
> in OCaml runtime, and we wrote our own a bit less broken version for
> the CoqHammer plugin.
>
> Best,
> Lukasz
>
>
> On 2 May 2018 at 20:41, Emilio Jesús Gallego Arias
> <e AT x80.org>
> wrote:
>> Burak Ekici
>> <ekcburak AT hotmail.com>
>> writes:
>>
>>> The latest release of Coq (8.8.0) seems to drop the "set_timeout"
>>> function from "control.ml". How can I simply mimic it? We want to use a
>>> particular timeout function...
>>
>> Umm, that function was pretty internal so I wonder what your use case
>> is. Please open a ticket on GitHub and we will add the interface back
>> for 8.8.1
>>
>> E.
- [Coq-Club] set_timeout in 8.8.0, Burak Ekici, 05/02/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Emilio Jesús Gallego Arias, 05/02/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Łukasz Czajka, 05/03/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Gabriel Scherer, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Łukasz Czajka, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Łukasz Czajka, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Gabriel Scherer, 05/09/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Xavier Leroy, 05/10/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Gabriel Scherer, 05/09/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Tej Chajed, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Łukasz Czajka, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Łukasz Czajka, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Jacques-Henri Jourdan, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Łukasz Czajka, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Gabriel Scherer, 05/07/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Łukasz Czajka, 05/03/2018
- Re: [Coq-Club] set_timeout in 8.8.0, Emilio Jesús Gallego Arias, 05/02/2018
Archive powered by MHonArc 2.6.18.