Project

General

Profile

Bug #1095

TimeOut not working as hoped/expected

Added by John Abbott 11 months ago. Updated 8 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
enhancing/improving
Target version:
Start date:
29 Aug 2017
Due date:
% Done:

100%

Estimated time:
1.11 h
Spent time:

Description

I had hoped to use the "time out" feature in a loop similar to this:

for i := 1 to 1000 do
  I := RandomIdeal(...);
  try
    GB := GBasisTimeout(I, 5.0);
  UponError E do /*nothing*/
  EndTry;
  ...
endfor;

Unfortunately as currently implemented the "time out" causes an interrupt (like Ctrl-C) rather than a normal error; so control leaves the try block whenever a time out occurs...

Discuss; fix.


Related issues

Related to CoCoALib - Feature #385: Design new errors using inheritanceIn Progress2013-07-08

History

#1 Updated by John Abbott 11 months ago

  • Description updated (diff)

Is a "timeout" more like an interrupt (which cannot be caught by a try block)?
Or is it more like an error (which can be caught by a try block)?

In my example I wanted it to behave like an error.
Was my desire correct?

#2 Updated by Anna Maria Bigatti 11 months ago

  • % Done changed from 0 to 10

John Abbott wrote:

Is a "timeout" more like an interrupt (which cannot be caught by a try block)?
Or is it more like an error (which can be caught by a try block)?

My first thought was it should be like an interrupt ("interrupt after ..seconds"),
but I see it could be viewed similarly to the "insufficient precision" error.

The question is: how can we detect the computation finished?
One easy way is this (probably easier than try/catch for the common user):

UnsetValue := 145692761358726487564386; -- whatever object
GB := UnsetValue;
GB := GBasisTimeout(I, 10);
if GB <> UnsetValue then ...

#3 Updated by John Abbott 11 months ago

  • Related to Feature #385: Design new errors using inheritance added

#4 Updated by John Abbott 10 months ago

  • Status changed from New to Resolved
  • Assignee set to John Abbott
  • % Done changed from 10 to 80

I have modified the code so that TimeoutException is now derived from ErrorInfo (rather than InterruptException). This seems to make everything work as expected (based on just 1 test).

I'll check in shortly.

#5 Updated by John Abbott 8 months ago

  • Status changed from Resolved to Closed
  • % Done changed from 80 to 100
  • Estimated time set to 1.11 h

I have not really tested this, but think that the current impl is OK anyway ==> closing.

Also available in: Atom PDF