[Bug Fix] Fixed race condition in slave session.

Message queue is thread-unsafe by design: uncontrolled access to it from multiple threads results in undefined behavior. All chunks are guaranteed to be pushed from engine's thread, but `invoke` event is sent from session creator thread which differs from the previous one. Sometimes `chunk` event was followed by `invoke` event, which is bug.

Now message queue is synchronized explicitly.