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
7
votes
9 answers

why is this an infinite loop in python?

I can't seem to figure out why this is an infinite loop in python?? for i in range(n): j=1 while((i*j)
Matt Phillips
  • 11,249
  • 10
  • 46
  • 71
7
votes
2 answers

My cin is being ignored inside a while loop

I am trying to code a simple question and number checker into my first C++ program. Problem is, when I type a string like one two, or three, the program becomes and infinite loop and it ignores the cin function to re-assign lives to a number. cout…
Logan Saso
  • 73
  • 1
  • 1
  • 5
7
votes
3 answers

What happens when you have an infinite loop in Django view code?

Something that I just thought about: Say I'm writing view code for my Django site, and I make a mistake and create an infinite loop. Whenever someone would try to access the view, the worker assigned to the request (be it a Gevent worker or a Python…
Ram Rachum
  • 84,019
  • 84
  • 236
  • 374
7
votes
2 answers

Infinite loop when debugging in Visual Studio 2010

I have a strange issue with VS2010 (building a large C++ project). When starting to debug, the execution goes in something like an infinite loop. I put the a breakpoint at the first line of main(), but the breakpoint is never reached. I also tried…
Violin Yanev
  • 1,507
  • 2
  • 16
  • 23
7
votes
4 answers

C++ cin keypress event

I believe this is a very simple question, but I can't find a simple answer to it. I have an infinite loop, e.g. while(1), for(;;), and I need to break from the loop on a keypress. What is the easiest way to do this? P.S.: I can't use getch,…
Lukas Salich
  • 959
  • 2
  • 12
  • 30
7
votes
1 answer

How to make an endless scrolling img slider?

I have nearly finished off a website for a client at work, which has a large full width dynamic slider on the home page. As they gave few specifications, currently the slider is very basic; it simply scrolls left to right by changing the left CSS…
Robin Neal
  • 509
  • 5
  • 21
7
votes
5 answers

How to debug, and protect against, infinite loops in PHP?

I recently ran up against a problem that challenged my programming abilities, and it was a very accidental infinite loop. I had rewritten some code to dry it up and changed a function that was being repeatedly called by the exact methods it called;…
Robert K
  • 30,064
  • 12
  • 61
  • 79
7
votes
3 answers

Why doesn't a request with an infinite loop get killed by ColdFusion request timeout?

First, I set Timeout Requests after (seconds) to 20 in CF Admin. Then I run a cfm with a line like while(true); The page will run way past 20 seconds, and the thread is still alive as I wrote this. Below is a snapshot taken with Server…
Henry
  • 32,689
  • 19
  • 120
  • 221
6
votes
5 answers

How Do I Safely Scan for Integer Input?

Scanner scanner = new Scanner(); int number = 1; do { try { option = scanner.nextInt(); } catch (InputMismatchException exception) { System.out.println("Integers only, please."); } } while (number !=…
Maxpm
  • 24,113
  • 33
  • 111
  • 170
6
votes
1 answer

Jetpack Compose + Navigation - Infinite loop on navigate()

I'm using Jetpack Compose + Navigation (Single Activity, no Fragments) and i'm trying to perform a navigation route as follow: SplashScreen ---(delay)---> AuthScreen ---(if successful)--> MainScreen Unfortunately, when i perform Login, the function…
6
votes
4 answers

How to prevent infinite looping without ExecutionContext.CallerOrigin in Microsoft Dynamics CRM 2011?

When creating a plugin in Microsoft Dynamics CRM 4.0 you could use the following to check the origin of the event that caused the plugin to fire. public void Execute(IPluginExecutionContext context) { if (context.CallerOrigin.GetType()…
csjohnst
  • 1,678
  • 3
  • 17
  • 24
6
votes
2 answers

How to resolve an infinite loop in requestAccess(to:completion:) on EKEventStore?

I am switching on EKAuthorizationStatus but even after requestAuthorisation(to:commit:) is called and returned true and no error the switch statement still matches the .notDetermined case and a recursion in it is producing an infinite loop. And it…
6
votes
2 answers

Authenticating MVC application causes endless redirect loop with OpenID Connect 3

THE PROBLEM I have a problem using OpenID Connect 3 to provide authorisation for a website I am developing. The problem goes like this: I visit a protected page and am redirected to the IdentityServer (OpenID Connect 3) The Identity server asks for…
6
votes
3 answers

Spring Data JPA @OneToMany infinite loop exception

OneToMany relationship causing infinite loop using Spring Data JPA with hibernate as provider The problem here is not the type of exception but the infinite loop that causes this exception I tried @JsonIgnoreProperties which gives me another error…
Merv
  • 1,039
  • 2
  • 12
  • 22
6
votes
2 answers

Vue.js watchers trigger an inifinite loop

I'm building an aspect ration calculator. How can I avoid an infinite loop, if I have 4 variables that depend on each other? I had to set 4 watchers, one for each data element. watch: { widthRatio(value) { this.pxWidth = (value * this.pxHeight) /…
Sammi
  • 286
  • 1
  • 3
  • 11