pop the loop block even for infinite while loops (closes #23048)
merge 3.4 (#23048)
make sure server threads get cleaned up
merge 3.4