Dennis Gorelik (
dennisgorelik) wrote2020-06-08 06:40 pm
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Entry tags:
5 years old bug
Today we discovered and fixed a bug that was running in our backend system for 5 years.
In theory, I know that there are long-running bugs in most complex systems. This bug was one of such practical confirmations.
The correct SQL code should have been:
NonDeliverableEmailResumeUCleanup.cs/MarkResumeUDeletedForSpamComplaint()
But due to the bug, instead of "spProcessPointerSet" MarkResumeUDeletedForSpamComplaint() had "spProcessPointerGet" (second time), so "MarkResumeUDeletedForSpamComplaint" ProcessPointer did not move after finishing batch processing.
Still this buggy system worked.
MarkResumeUDeletedForSpamComplaint() kept reprocessing spam complaint records from the beginning - instead of processing only unprocessed spam complaints.
Finally, 5 years after writing this buggy code, one of the users complained that PostJobFree deletes his resumes several minutes after he post them. We started to investigate and, eventually, found this bug.
In theory, I know that there are long-running bugs in most complex systems. This bug was one of such practical confirmations.
The correct SQL code should have been:
NonDeliverableEmailResumeUCleanup.cs/MarkResumeUDeletedForSpamComplaint()
exec spProcessPointerGet ... select ... update ... exec spProcessPointerSet ...
But due to the bug, instead of "spProcessPointerSet" MarkResumeUDeletedForSpamComplaint() had "spProcessPointerGet" (second time), so "MarkResumeUDeletedForSpamComplaint" ProcessPointer did not move after finishing batch processing.
Still this buggy system worked.
MarkResumeUDeletedForSpamComplaint() kept reprocessing spam complaint records from the beginning - instead of processing only unprocessed spam complaints.
Finally, 5 years after writing this buggy code, one of the users complained that PostJobFree deletes his resumes several minutes after he post them. We started to investigate and, eventually, found this bug.
no subject
no subject
Мы тоже тестировали.
А потом сделали рефакторинг (с ошибкой) и получился баг.
Нужны автотесты, но полностью покрывать функциональность тестами - дорого.