Fix race condition when processing multiple message for the same session