add mutex to protect the session globale variable