Backported the queue routing retry code from 4.2 to 4.1.
This fixes a segfault caused in this code. TRQ-1659