For v2.9.1 inside org.apache.logging.log4j.util.LoaderUtil and getClassLoaders() method we have lines 120-123 as such:
ClassLoader parent = tcl;
while (parent != null && !classLoaders.contains(parent))
where it looks like some getParent() call is either missing or otherwise "while" loop is not needed.
In line 111 tcl classloader already added into list of clasloaders:
Was it an attempt to add all classloaders hierarchy or just some immediate parents?