Video in progress

Strong Junior 🤝 Soft skills

Tell me about the hardest bug you've solved, using STAR.

A short context, the symptom, how I searched (logs, debugger, hypotheses), the root cause and the fix, and finally what I did so it wouldn't recur. The interviewer mostly listens to the search process.

📖 Answer

In this question the technical detail matters, but the story must not be confusing. A sample answer:

Situation. On prod, some users would see someone else's cart. Once or twice a day, and it couldn't be reproduced.

Task. I was assigned to find the cause.

Action. First I added userId and requestId to the logs. After two days it became clear that the problem happened with simultaneous requests. Reading the code, I found a currentUser stored in a field of a singleton @Service, which was state shared by all threads.

@Service
class CartService {
    private User currentUser; // bug: one field for all requests
}

I changed it to a method parameter and wrote a test that reproduced it with two threads.

Result. The problem went away. I wrote the team a short reminder about not keeping state in singleton beans, and that point was added to the code review checklist.

Don't shorten the "how I searched" part in the story, because that's exactly what the interviewer evaluates. And make sure it's a bug you really solved: details get asked about in the second or third question.