December 18, 2012

Ticketing & Locking

We provide services to facilitate communication between us and our distributors. This application is called "contacts". Any contact request can only be updated by one party at a time (it is locked while someone has the page open), but the person who logged the question is always able to view the request.

Today I received a mail about an issue with the locking system. Our customer was told that their contact request was under treatment by themselves and that they could not update it while someone else was editing.

After spending a while trying to figure out under which circumstances a contact was locked and unlocked and not being able to find anything (seriously) wrong with it I looked a bit further.

Turns out that the column in the table that stores who locked the contact contained the name of the user instead of the (expected) user-id.

The fun part was this: This column was limited to 20 characters and the users' name was longer than that. The result? A concatenated string and the comparison that goes wrong everywhere, considering the actual contact owner and the person who locked the request as 2 different ones.

Welcome to the world of non-programmers writing code.