No, it does not "work fine" even without --with-debug, except by pure chance. After THREADS_ALLOW(), Pike_fp->current_storage may change at any time due to other threads executing pike code. Therefore, the value of THIS is undefined. The code needs to assign THIS->request to a local C variable _before_ calling THREADS_ALLOW().