8

Was working on a system we planned on to deliver to a hospital
basically it was meant for controlling and monitoring pactions coming in and attendance time from the staff

Got it off the ground well and got to where the system was supposed to update room status
occupied/free then horror started
the db was not setting the room free after clearing a client off the list... room remained occupied and this kept on happening for 6 months and I was so focused on fixing the db models thinking thats where the problem was....

1 day after leaving the project for several months i just revisited the project randomly and started going through the whole code base trying to make sense of what was happening as there where no errors generated..
I had to verify the whole system logic... and that day i figured out what was happening...
upon adding a client to a room the system was also creating a duplicate room so when the function for setting the room free executes it would set the duplicate room free and not the actual room and the system would pick the room with occupied state causing the user not being able to assign new pactions to the room

Solving this brought so much relief coz it required so much work just to solve what seemed to be a minor issue

Comments
  • 1
    Taking a break from a problem is often a good way to get a new angle.
  • 0
    I wonder, how one could accidentally duplicate rooms. Only thing that comes to mind is a reckless "on duplicate key insert" clause when updating a joined record.
  • 1
    @Oktokolo actually the actual function meant for creating rooms had some checks to prevent that from happening

    this function creating duplicate rooms had nothing to do with creating rooms so the checks where not effective
  • 1
    That's why people disable the copy constructor in some cases
  • 0
    @Taqsblaz3 Normally you don't even need checks for duplication not happening. Creation and duplication of stuff are things you have to actively do. Like evaling user data or calling external commands with unescaped arguments, they don't just happen magically.

    What has been done to make it happen? Postmortems are the real content!
Add Comment