If it get stuck in XSetSelectionOwner it is not feasible, as this is
a synchronous call in X. Can you verify that it is there it is stuck?
Hmm.... OK it turns out that it's a problem due to my own local hacks (see
the patch below). So in a vanilla Emacs, the way to reproduce a similar
problem is to do C-y when another app has the selection and is frozen.
But unless we add a timeout, there is little we can do about it in the case
of C-y. In the case of the patch below, I'd want to run
interprogram-paste-function asynchronously, but it's not clear how to do.
That's too bad: I was planning to submit the patch below for inclusion.