Asynchronous tasks run as MySQL Events on the server. Therefore, only those specific SQL operations that are supported inside events are supported for creating asynchronous tasks.
Any SQL operation that depends on the return value of the
SESSION_USER()
orUSER()
function might behave differently when run asynchronously. This is because MySQL Events are executed by a reserved internal user calledevent_scheduler
, and theSESSION_USER()
andUSER()
functions return the valueevent_scheduler
instead of the actual session user name.When an asynchronous task attempts to obtain a lock on a database resource, but it unable to get it as another transaction holds a conflicting lock, an error is generated and the following message is displayed:
Cannot acquire lock. Try again later.