Mestastore is running as a standalone process/service outside the HS2 JVM. This issue was seen after the following occured (there is no indication of a problem prior)
1) Upgrade the HMS DB (mysql)
2) Running with slightly newer version of HUE.
3) About 15 parallel beeswax sessions to HS2 each running a query.
We haven't been able to reproduce this in-house using a JDBC Client that spins off threads that connect to HS2, run a query & exit.
We suspected that it was one of the two causes
1) Socket timeouts during read by parallel invocations between HS2 (HMS Client) & HMS.
2) Concurrency issues in HMS on invocations to HMS.
After noticing Socket timeout exceptions in the HS2 logs, we had the customer increase the socket read timeouts from 90s to 120s. Did not help, but also the hive logs indicate that the "out of sequence" errors occurred first then the socket timeouts, pretty far apart in time. So the socket read timeout is not likely the root cause.
It must be concurrent access to the HMS by multiple beeswax sessions thats causing this issue.
Hope this helps.