Hmm, it looks like the xlog-switch is trying to wait for itself to finish. The concurrent TRUNCATE is just being blocked behind the xlog-switch, which is stuck on itself.
I wasn't able to reproduce exactly that, but I got a PANIC by running pgbench and concurrently doing "select pg_switch_xlog()" many times in psql.
Attached is a new version that fixes at least the problem I saw. Not sure if it fixes what you saw, but it's worth a try. How easily can you reproduce that?
With v23, it got stuck both times I tried it, once after 4 hours and once after 6 hours.
With v24, it has been running for 30 hours so far with no problems. So there is a pretty good chance that it is fixed.
This is using the same testing harness as in the last round of this patch.