The problem is not obvious to me. You have two "if" conditions outside of the if(save()) call. Did you check if they have problem? What about the first line? Does it always returns a not-null session?
i've got a client program in python for the client side and can define the max of simultaneous connections to the server.
if only one connection at once there's no problem… but with five simultaneous connections in about 30% of theses requests the $session couldn't be saved… and $this->answers['E'] becomes an empty array…
Yes, there is a CUniqueValidator that you may use.
However, for your testing scenario, I think you probably should consider enclosing the uniqueness check and saving inside a transaction. Otherwise it is very likely something will not be saved due to uniqueness constraint.