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: Łukasz Czajka <lukaszcz AT mimuw.edu.pl>
  • To: Gabriel Scherer <gabriel.scherer AT gmail.com>
  • Cc: Coq Club <coq-club AT inria.fr>, Burak Ekici <ekcburak AT hotmail.com>
  • Subject: Re: [Coq-Club] set_timeout in 8.8.0
  • Date: Mon, 7 May 2018 12:52:49 +0200
  • Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=lukaszczz AT gmail.com; spf=Pass smtp.mailfrom=lukaszczz AT gmail.com; spf=None smtp.helo=postmaster AT mail-io0-f170.google.com
  • Ironport-phdr: 9a23:839pWR+yvmq/8P9uRHKM819IXTAuvvDOBiVQ1KB41OocTK2v8tzYMVDF4r011RmVBd6ds6oMotGVmpioYXYH75eFvSJKW713fDhBt/8rmRc9CtWOE0zxIa2iRSU7GMNfSA0tpCnjYgBaF8nkelLdvGC54yIMFRXjLwp1Ifn+FpLPg8it2O2+55Pebx9UiDahfLh/MAi4oQLNu8cMnIBsMLwxyhzHontJf+RZ22ZlLk+Nkhj/+8m94odt/zxftPw9+cFAV776f7kjQrxDEDsmKWE169b1uhTFUACC+2ETUmQSkhpPHgjF8BT3VYr/vyfmquZw3jSRMNboRr4oRzut86ZrSAfpiCgZMT457HrXgdF0gK5CvR6tuwBzz4vSbYqINvRxY7ndcMsYSmpPXshfWS9PDJ6iYYQTAOQMJvpYr5DnqlcSsReyGQuhCeXywTFInH/22qg63vwnHwHb3wwvBckOsXXMo9jrNaYdS+K1zKrSwj7eaP5W3Sr96IvSfRA6oPCDQbNxfNHUyUkuEgPFk1uRpZb7MDyIy+QBqXCb7+55WO+plmUpqBlxryCxysswjoTFnIEYx1De+Sln3oo4K8e0RFN5bNK4FpZbqjuUOJFsQsw4RmFloCY6xaMCuZ68ZCUKzY4oxx/ba/CecoiI5Q7vWP+fITtlhn9pZKizhxm18Uinxe38Ute73ExWoSpCl9nArnEN1xrN5cibUvZx4Fut1DKV2w3Q6uxIO144mbTVJpI737I9lIYfvVzGHiDsmUX2iKGWdl8j+uit8+nnZqjmppyGOI9viwDxLqUvm82kDOQ3NwgBRWmb+eCm2LL/+k35Ra1GjucqnanBrJDaOcMbq7alDA9Sy4Yv8gqwDzO70NsDhnQHN1JEeBefj4fzIV3OIfb4De2+g1u2ijtryerGbfXdBcDiJ3LZkbrlNY1260NGxRB7md9W7YhVB7VHO/nzV1X8rvTXCxY4N0q/xOOxW/tn0YZLfX+MC7SLB4jAuF2L76p7J/SPbZQHsyTVLvkg+uGogHMk30cZK/r6laALYWy1S6w1a36SZmDh15JYST9T71gOCdfygVjHagZ9InO7XqYy/DY+Udv0AoLKR4Tri7uEjn7iQs9mI1teA1XJKk/GMp2eUq5VOi2XK85l1DcDUOr5EtJz5VSVrAb/joFfAK/U9ykf78yx0dF046jSkkl3+2UrV4KS1GaCS2wylWQNFWc7

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