If any meta operations are used while an occlusion query is in progress (such as by calling glClear) then the results aren't saved and restored correctly so the final value is wrong. I posted a patch for this a while ago and I'm opening a bug so we don't forget about it.
There is also a piglit test for it which I pushed to master
I've pushed the patch.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct.