Variables being shared during simultaneous calls to a cloud code function

We’re seeing a very strange bug in our system. If two users on two different devices call a cloud code function at the same time, the vars inside that cloud code function are overridden by one of the calls and data is lost/corrupted. Have we implemented something wrong or is this a known bug?

Note: Inside the cloud code function we have nested async functions that share vars inside the cloud code function.

You probably implemented something wrong. Can you share the code?