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
6
votes
16 answers

Redirect loop on wp-admin or wp-login.php

I put together a quick WordPress site locally using MAMP, then checked it into an SVN repo. I then checked it out on to my development server. I didn't change anything except to run the search and replace tool script from Interconnectit to updated…
codewithfeeling
  • 6,236
  • 6
  • 41
  • 53
6
votes
1 answer

while(true) / while(1) vs. for(;;)

Possible Duplicate: for ( ; ; ) or while ( true ) - Which is the Correct C# Infinite Loop? Why choosing for (;;){} over while(1)? What's the difference between while(true), while(1), and for(;;)? They all are infinite loops in languages like C#…
user1931083
6
votes
3 answers

302 Infinite Loop

I have a web application that is stuck in an infinite loop, and I have no idea where to look next. This is an intranet site, so there is no link I can share, but I've listed as many details as I can think of below. I would appreciate any ideas or…
Johnie Karr
  • 2,744
  • 2
  • 35
  • 44
5
votes
3 answers

Why does this 'for(;;)' loops?

What in the world is making the second parameter return true? WARNING: it will loop infinitely and might crash your browser for(;;){ //... } I was totally expecting not to loop at all... But it is running, and that makes it worse since it can…
ajax333221
  • 11,436
  • 16
  • 61
  • 95
5
votes
3 answers

Strange behaviour when reading in int from STDIN

Suppose we have a menu which presents the user with some options: Welcome: 1) Do something 2) Do something else 3) Do something cool 4) Quit The user can press 1 - 4 and then the enter key. The program performs this operation and then presents the…
Ozzah
  • 10,631
  • 16
  • 77
  • 116
5
votes
2 answers

Detect infinite HTTP redirect loop on server side

Is there a way to detect infinite HTTP 3xx redirect loops on the server? (Not necessarily the exact moment when the client gives an error, as the number of redirects required for that is client-dependent, but log an error after, say, 10 continuous…
Tgr
  • 27,442
  • 12
  • 81
  • 118
5
votes
1 answer

IIS 7.5 Rewrite Bug? Infinite loop

We use IIS 7.5 URL Rewrite, with classic ASP. Everything works properly 99% of the time, however, completely sporadic, pages of our site will fall into a redirect loop for no apparent reason. Meaning, we have articles that render fine 99% of the…
devnuts
  • 137
  • 2
  • 14
5
votes
5 answers

Infinite loop problem with while loop and threading

Using a basic example to illustrate my problem I have 2 near-identical bits of code. This code causes the while loop to run infinitely. private boolean loadAsset() { new Thread(new Runnable() { @Override public void run() { …
Sonoman
  • 3,379
  • 9
  • 45
  • 61
5
votes
0 answers

Fixing "Type instantiation is excessively deep and possibly infinite." in a compositional function

I have a function I created that chains functions together. I've created a bunch of generic typings to correctly correlate the arguments that the resulting function can have. You can read more about this paradigm here, what I'm looking for and why I…
5
votes
9 answers

Increment forever and you get -2147483648?

For a clever and complicated reason that I don't really want to explain (because it involves making a timer in an extremely ugly and hacky way), I wrote some C# code sort of like this: int i = 0; while (i >= 0) i++; //Should increment…
Peter Olson
  • 139,199
  • 49
  • 202
  • 242
5
votes
1 answer

React hooks, set return value of a function to state causes infinite loop

Infinite loop on setting state I have a array of objects testData, which I want to filter through to get another array with results: const testData = [ { time: "2020-01-23T13:16:53+01:00", amount: "0.010000000000000000", …
Navian
  • 53
  • 6
5
votes
1 answer

Infinite recursion in Haskell

This question is essentially a duplicate of Debugging infinite loops in Haskell programs with GHCi. The author there solved it manually, though I'd like to know other solutions. (my particular problem) I have an arrow code which contains a recursive…
gatoatigrado
  • 16,580
  • 18
  • 81
  • 143
5
votes
1 answer

Why does recursive binding of arrow function in Haskell loop infinitely?

I'm learning how to use Arrows in Haskell by implementing a simple interpreter for the comm language. I have an eval function which evaluates an expression into a value, but eval loops indefinitely when feeding in any expression. -- Interp.hs eval…
Myuri
  • 55
  • 1
  • 7
5
votes
3 answers

C# loop and keypress break loop

My code consists of something like this: { var comeback = Cursor.Position; code goes here code goes here code goes here code goes here code goes here code goes here Cursor.Position = restart; } Now, I wish to have…
Kyle
  • 151
  • 3
  • 3
  • 6
5
votes
3 answers

Python how can I manually end an infinite while loop that's collecting data, without ending the code and not using KeyboardInterrupt?

In my code I have a "while True:" loop that needs to run for a varying amount of time while collecting live data (3-5 hours). Since the time is not predetermined I need to manually end the while loop without terminating the script, so that it may…
rum404
  • 97
  • 5