Questions tagged [infinite-loop]

An "infinite loop" is a loop in which the exit criteria are never satisfied; such a loop would perform a potentially infinite number of iterations of the loop body. The general problem of determining whether the execution of a loop with given preconditions will result in an infinite loop is undecidable; in other words, there is no algorithm to determine whether an execution of a loop will eventually terminate. This is known as the halting problem.

3528 questions
16
votes
2 answers

Virtualization type 'hvm' is required for instances of type 't2.micro'

Seems selecting t2.micro for an ElasticBeanstalk instance throws Beanstalk into an infinite loop. Been an hour since creating the Beanstalk instance, 20min since the last event update in the Beanstalk management console. Does anyone know how to…
Tim Fulmer
  • 14,970
  • 7
  • 28
  • 34
15
votes
2 answers

curious about how "loop = loop" is evaluated in Haskell

I thought expressions like this would cause Haskell to evaluate forever. But the behaviors in both GHCi and the compiled program surprised me. For example, in GHCi, these expressions blocked until I Control+C, but consumed no CPU. Looked like it was…
Phil
  • 5,595
  • 5
  • 35
  • 55
15
votes
2 answers

Robust endless loop for server written in Python

I write a server which handles events and uncaught exceptions during handling the event must not terminate the server. The server is a single non-threaded python process. I want to terminate on these errors…
guettli
  • 25,042
  • 81
  • 346
  • 663
15
votes
1 answer

Find infinite loop in progress?

Is there a way to find out the current execution of the code to find out the infinite loop? I have the application running with the current source. I'm attached with the visual studio debugger. I just need to know where the code is currently at so…
jdelator
  • 4,101
  • 6
  • 39
  • 53
15
votes
4 answers

Why do I get an infinite loop if I enter a letter rather than a number?

I am writing this code for a homework assignment (just starting C++ so please go easy). We've just started while, do-while, and for loops today. The program runs fine except that if you enter a letter when the program asks for an integer, it loops…
user2907563
  • 151
  • 1
  • 1
  • 4
14
votes
6 answers

Can massive nested loops cause the linker to run endlessly when compiling in Release-Mode?

I'm compiling a very small Win32 command-line application in VS2010 Release-Mode, with all speed optimizations turned on (not memory optimizations). This application is designed to serve a single purpose - to perform a single pre-defined complex…
Giffyguy
  • 20,378
  • 34
  • 97
  • 168
14
votes
2 answers

Is an (empty) infinite loop undefined behavior in C?

Is an infinite loop like for (;;); undefined behavior in C? (It is for C++, but I don't know about C.)
user541686
  • 205,094
  • 128
  • 528
  • 886
14
votes
3 answers

Infinite loop invalidating the TimeManager

I am experiencing a very tricky defect in my WPF application to track down. The error message is: An infinite loop appears to have resulted from repeatedly invalidating the TimeManager during the Layout/Render process. The stack trace (for what…
Mike Malter
  • 1,018
  • 1
  • 14
  • 38
13
votes
3 answers

Limiting execution time of embedded Python

If I embed the Python interpreter in a C or C++ program, as in this example, is there any way to limit how long the interpreter runs for? Is there anything to stop the Python code from entering an infinite loop and thus preventing…
user200783
  • 13,722
  • 12
  • 69
  • 135
13
votes
4 answers

Is there any way to kill a setInterval loop through an Onclick button

So, I got an infinite loop to work in this function using setInterval attached to an onClick. Problem is, I can't stop it using clearInterval in an onClick. I think this is because when I attach a clearInterval to an onClick, it kills a specific…
JoeOzz
  • 131
  • 1
  • 1
  • 6
13
votes
2 answers

C# - How to create a non-detectable infinite loop?

This is just an "I am Curious" question. In C#-in-depth Jon Skeet says about lambda expressions: "if there is a nonvoid return type every code path has to return a compatible value." (Page 233) The footnote then says: "Code paths throwing exceptions…
Vaccano
  • 78,325
  • 149
  • 468
  • 850
13
votes
1 answer

Are non-terminating constexpr functions well-defined?

Consider the following code: constexpr unsigned f(unsigned x) { while (x & 1) x *= 3; return x; } int main() { char a[f(2)]; char b[f(1)]; } In case it isn't obvious: for odd integers x, the function f never terminates. When I…
fredoverflow
  • 256,549
  • 94
  • 388
  • 662
13
votes
1 answer

Angular Route Infinite Loop

For some reason when I have a dynamic property in my route and access that page I get stuck in an infinite loop where that page will continuously request itself. .config(["$routeProvider", "$locationProvider", function($routeProvider,…
micah
  • 7,596
  • 10
  • 49
  • 90
12
votes
2 answers

Infinite loop heisenbug: it exits if I add a printout

This is my source code: #include #include using namespace std; double up = 19.0 + (61.0/125.0); double down = -32.0 - (2.0/3.0); double rectangle = (up - down) * 8.0; double f(double x) { return (pow(x, 4.0)/500.0) -…
Anonymouse
  • 385
  • 3
  • 16
12
votes
5 answers

How to run infinitely script in background on Linux?

I have a PHP script with infinite loop. I need this script running forever. So, I run php /path/to/script.php > /dev/null & And it works in background in my current user's security context. But when I close terminal window (log off), of course,…