drupal_set_message doesn't display message sometimes
It sounds like you need to maintain a stable message storage solution until the operation is complete.
The D7 core message functions drupal_set_message() &amp; drupal_get_messages() (the core function used when retrieving messages for rendering) are pushing/popping messages to session var, $_SESSION['messages'] These messages are designed around a single page request/received operation.
If there many different async requests going on with the same session (or other modules calling drupal_get_messages() with its default options), its likely $_SESSION['messages'] is being cleared out before rendering when you need it.
Try storing your messages somewhere else (e.g. another session variable) then call drupal_set_message() with your messages once the full operation is complete. If most messages are background ops, you should use consider watchdog() for logging background ops and then use drupal_set_message() for a &quot;operation complete&quot; message.