Fix deadlock by moving `res.get` outside of synchronized block.

Fixed #1002275.

I don't have a reproducible test case, but this should release the hashmap lock that's blocking the PC from making progress in completing `res`.