Not sure this helps but are you SNATting? If so, perhaps the server is accepting connections from the F5 Self-IP address but not the SNAT address?
On the subject of the loop, I'd recommend that some simple counting is employed to ensure the looping is short lived;
when CLIENT_ACCEPTED {
set loopcounter 0
}
when LB_FAILED {
set selected_server [LB::server addr]
if {$selected_server == ""} {
log local0. "No mdex node available"
}
elseif { loopcounter <=4 } {
log local0. "Node: ${selected_server} not responding."
Select another node
LB::reselect
incr loopcounter }
}