Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56684 Add a workaround for a bug that should never happen along with some basic debug logging.