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.
on Jan 16, 2017 at 17:19:12.
(provided by the Example extension).