Skip to content

Hanging Code #1

@mrfrase3

Description

@mrfrase3

Someone submitted the following code to be compiled, something about it caused the compiler to hang and not return anything.

Whilst it was taking 1 min to timeout, the user became impatient and spammed the compile button, causing the compile server to become overloaded.

Need to:

  • find the cause of the issue in this code
  • impose rate limiting on compiling
char val;
#include<Servo.h>
Servo myServo
/'myServo
const int controlPin1 = 2;
const int controlPin2 = 3; 
const int enablePin = 9;

void setup() {
  myServo.attatch(4);
  pinMode(controlPin1, OUTPUT);
  pinMode(controlPin2, OUTPUT);
  pinMode(enablePin, OUTPUT);
}
   
if (val=='a'){
  myServo.Write(90);
  delay(40);
}

else if (val=='d'){
  myServo.Write(180);
  delay(30);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions