line / line/centraldogma

Send '503 Service Unavailable' when handling a request already timed out

Open
#392 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

defect
Dominant language
Java
Stars
668
Forks
135
Avg merge
4d 19h
Merged PRs (30d)
7

Description

`IllegalStateException: Request already timed out` has to be translated to `503 Service Unavailable` but it is currently being translated to `500 Internal Server Error`:

```
[WARN] (CentralDogmaExceptions.java:77) Unexpected exception with error code INTERNAL_SERVER_ERROR (2) from: watchFile()
com.linecorp.centraldogma.internal.thrift.CentralDogmaException: java.lang.IllegalStateException: Request already timed out.
at com.linecorp.centraldogma.server.internal.thrift.Converter.convert(Converter.java:215)
at com.linecorp.centraldogma.server.internal.thrift.CentralDogmaServiceImpl.logAndInvokeOnError(CentralDogmaServiceImpl.java:396)
at com.linecorp.centraldogma.server.internal.thrift.CentralDogmaServiceImpl.lambda$handleWatchFileResult$24(CentralDogmaServiceImpl.java:388)
at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:822)
at java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:797)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
at com.linecorp.armeria.common.util.Functions.lambda$voidFunction$0(Functions.java:182)
at java.util.concurrent.CompletableFuture.uniExceptionally(CompletableFuture.java:870)
at java.util.concurrent.CompletableFuture$UniExceptionally.tryFire(CompletableFuture.java:852)
at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
at com.linecorp.centraldogma.server.internal.storage.repository.cache.CachingRepository.lambda$null$3(CachingRepository.java:199)
...
Caused by: java.lang.IllegalStateException: Request already timed out.
```

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Converter.convert at Converter.java:215 and trace how the IllegalStateException from CentralDogmaServiceImpl is mapped. Reproduce the request-timeout path shown in the stack trace, then add or update coverage for the expected 503 Service Unavailable response and verify that other unexpected exceptions remain 500.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.