Recently when categorizing items on Commons, sometimes items added to a category don't show up in that category. It seems to happen about 1% of the time. For example, https://commons.wikimedia.org/wiki/File:%E3%81%91%E3%81%97%E3%81%94%E3%82%80%E3%83%BB%E9%BB%92%E3%83%BB%E5%A4%A7_%286041044928%29.jpg has been added to Category:Taken with KDDI Sharp SH009, but when viewing that category the file isn't there (12 hours later). It could be fixed by null-editing the file, but I don't know any way to discover such files that require null editing, and it shouldn't be necessary.
My theory is that, its a race condition with slave lag. LinksUpdate::getAsJobSpecification() doesn't set masterPos flag, as a result, Revision::newFromTitle( $title, false, Revision::READ_NORMAL ); might get a stale page_latest field from the db, and refreshLinksJob will run on the old version of the page.
Being a race condition would fit with it only happening on a small percentage of pages.