API API Error Handling and Debugging 2 — Questions and Answers
Question 1: What does a 408 Request Timeout status code mean?
- Server processing took too long
- The client didn't send a request within the server's timeout period (Correct answer)
- Database query timed out
- SSL handshake failed
Correct answer: The client didn't send a request within the server's timeout period
408 Request Timeout means the server waited for the client to complete the request but the client didn't send it within the allowed time.
Question 2: What is 'error propagation' in microservices API testing?
- Spreading errors intentionally for testing
- How errors from one service flow through and affect dependent services (Correct answer)
- Logging errors to multiple systems
- Retrying failed requests
Correct answer: How errors from one service flow through and affect dependent services
Error propagation describes how failures in one microservice cascade through API calls to dependent services, a key concern in distributed systems testing.
Question 3: What is 'retry logic' in API client design?
- Repeating all test cases
- Automatically retrying failed requests with transient errors (Correct answer)
- Restarting the API server
- Re-running performance tests
Correct answer: Automatically retrying failed requests with transient errors
Retry logic automatically re-attempts API requests that fail with transient errors (like 503 or network failures) using strategies like exponential backoff.
Question 4: What is 'exponential backoff' in API retry strategies?
- Decreasing request rate over time
- Increasing the wait time between retries exponentially after each failure (Correct answer)
- Backing up API data exponentially
- Reducing payload size with each retry
Correct answer: Increasing the wait time between retries exponentially after each failure
Exponential backoff doubles the wait time after each failed retry (1s, 2s, 4s, 8s...), reducing load on a struggling server.
Question 5: What does a 409 Conflict status code indicate in REST APIs?
- Authentication conflict
- The request conflicts with the current state of the resource (Correct answer)
- Network packet collision
- Version mismatch
Correct answer: The request conflicts with the current state of the resource
409 Conflict indicates the request couldn't be completed because it conflicts with the current resource state, such as duplicate resource creation.
Question 6: What is 'circuit breaker' pattern in API error handling?
- Breaking the API into microservices
- Stopping calls to a failing service to allow it to recover (Correct answer)
- Encrypting failed requests
- Caching error responses
Correct answer: Stopping calls to a failing service to allow it to recover
The circuit breaker pattern stops sending requests to a failing service after a threshold of failures, giving it time to recover and preventing cascade failures.
What does a 408 Request Timeout status code mean?