Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] set_timeout in 8.8.0

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] set_timeout in 8.8.0


Chronological Thread 
  • From: Tej Chajed <tchajed AT mit.edu>
  • To: coq-club <coq-club AT inria.fr>
  • Cc: Gabriel Scherer <gabriel.scherer AT gmail.com>, ekcburak AT hotmail.com
  • Subject: Re: [Coq-Club] set_timeout in 8.8.0
  • Date: Mon, 07 May 2018 14:51:21 +0000
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=tchajed AT mit.edu; spf=Pass smtp.mailfrom=tchajed AT mit.edu; spf=None smtp.helo=postmaster AT dmz-mailsec-scanner-3.mit.edu
  • Ironport-phdr: 9a23:26AE3xJKIvKRtK4jZdmcpTZWNBhigK39O0sv0rFitYgRIv7xwZ3uMQTl6Ol3ixeRBMOHs6kC07KempujcFRI2YyGvnEGfc4EfD4+ouJSoTYdBtWYA1bwNv/gYn9yNs1DUFh44yPzahANS47xaFLIv3K98yMZFAnhOgppPOT1HZPZg9iq2+yo9JDffwtFiCChbb9uMR67sRjfus4KjIV4N60/0AHJonxGe+RXwWNnO1eelAvi68mz4ZBu7T1et+ou+MBcX6r6eb84TaFDAzQ9L281/szrugLdQgaJ+3ART38ZkhtMAwjC8RH6QpL8uTb0u+ZhxCWXO9D9QKsqUjq+8ahkVB7oiD8GNzEn9mHXltdwh79frB64uhBz35LYbISTOfFjfK3SYMkaSHJOUcZfVSNPAo2yYYgSAeQfIelVtJPyq0cUoBakGQWgGOHixzlVjXH2x6061OEhHBnY0gM+HdIFrWrZrNXvO6cQT++60bTDwDLfb/xK2Tfy8orIfQ48rvyXWLJwcNbRxVMxGAzYk1WdsIroNC6b2OQKtmiU9etgVeS3hm4oqgFxvjivxto3hYXTmo0VzVXE+CNky4g2Pd21UFN3bN2+HJZUrS2WKYt7Ttk/T2xnoCo21KEKtJqhcCUJyJkr3QDTZ+GFfoSS/x7uVvqdLDFlj3x/Yr2/nQy98U24x+38SMa01FFKozJYndnJt3EBzhnT5dKGSvt55UeuxyqA2xnI6u5YO080k6zbJIA7wrIpmJcfq0HDHi7qmEnskqCZa1gk9vCp6+ThfLrmuoeRO5J3hw3kNqkigNKzDOQiPgQTUGWX4eG826fi/U39TrVKlPo2kqzBvZDGOcsbprS2Aw1L3Yk+8Bu/Cjam0MgCkXYZMV1FZQqLj5L1NFHWPPD4EfC/jkywnzds3vDKJ6HuApHQLnfYi7rhZrZ860tEyAUp19xf5pRUCqsAIP3pQEPxusbYXVcFNFm/xP+iA9Fg3MtKUmWWR6SdLan6sFmS5+tpLfPaN6EPvzOoF/Unr9XuhH00lRdJYaKp1JkaZFi9H+ggLkmENym/yuwdGHsH61JtBNfhj0ePBHsKPy7rDvAMowojAYfjNr/tA4WkgbiPxiC+T89TZ3wAB1yRQy6xK9e0HswUYSfXGfdP1yQeXOnzTo49kxyiqV2ikuc1Hq/v4iQd8Knb+p116unUzkhg+TlmSsGU0mWWQmoxhWgBQTk7xuUk50l81hGO3bUq2/E=

I’ve already reported a bug that sounds like this issue (the timeout tactic sometimes doesn’t work): https://github.com/coq/coq/issues/7430. I didn’t include a good test but it seems like the Timeout vernacular doesn’t completely solve the problem.

I didn’t need to enable any multi-threading or asynchronous options to trigger this bug (not sure exactly what happens by default, though).


On Mon, May 7, 2018 at 9:03 AM Łukasz Czajka <lukaszcz AT mimuw.edu.pl> wrote:
>
> 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.
>

From the point of view of the Coq user, it is possible that you invoke
"timeout N tac" and sometimes this doesn't fail after N seconds but
runs forever. This is rare and random. This is definitely a bug.

> 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.
>

This may be the case, I'm not an expert here. I talked about the
problem with some Coq developers when I was at POPL this year, they
diagnosed what the problem was, and as far as I remember they said
it's a problem with OCaml's runtime and they can't do anything about
it. I didn't try to dig deeper and file a bug report. My description
of the problem as a "bug" in OCaml might have been inaccurate, because
I don't really know how the OCaml runtime is supposed to behave with
respect to the ALARM signal. But I believe it's definitely a bug as
far as the timeout tactical in Coq is concerned.

> 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.)

My experience with the Windows version of the timeout function is that
it doesn't work at all by itself.



Archive powered by MHonArc 2.6.18.

Top of Page