Index: src/modules/perl/mod_perl.c
===================================================================
--- src/modules/perl/mod_perl.c	(revision 1574926)
+++ src/modules/perl/mod_perl.c	(working copy)
@@ -56,7 +56,8 @@
 static apr_status_t modperl_shutdown(void *data)
 {
     modperl_cleanup_data_t *cdata = (modperl_cleanup_data_t *)data;
-    PerlInterpreter *perl = (PerlInterpreter *)cdata->data;
+    dTHXa(cdata->data)
+    tTHX perl = aTHX;
     void **handles;
 
     handles = modperl_xs_dl_handles_get(aTHX);
Index: src/modules/perl/modperl_config.c
===================================================================
--- src/modules/perl/modperl_config.c	(revision 1574926)
+++ src/modules/perl/modperl_config.c	(working copy)
@@ -143,7 +143,7 @@
     modperl_config_req_t *rcfg =
         (modperl_config_req_t *)apr_pcalloc(r->pool, sizeof(*rcfg));
 
-    MP_TRACE_d(MP_FUNC, "0x%lx", (unsigned long)rcfg);
+    MP_TRACE_d(MP_FUNC, "new request, rec: %pp rcfg: %pp", r, rcfg);
 
     return rcfg;
 }
Index: src/modules/perl/modperl_interp.c
===================================================================
--- src/modules/perl/modperl_interp.c	(revision 1574926)
+++ src/modules/perl/modperl_interp.c	(working copy)
@@ -274,17 +274,22 @@
     modperl_interp_pool_t *mip = interp->mip;
 
     MP_ASSERT(interp && MpInterpIN_USE(interp));
-    MP_TRACE_i(MP_FUNC, "unselect(interp=%pp): refcnt=%d",
-               interp, interp->refcnt);
+    MP_TRACE_i(MP_FUNC, "unselect(interp=%pp): refcnt=%d in use: %d",
+               interp, interp->refcnt, MpInterpIN_USE(interp));
 
-    if (interp->refcnt > 1) {
+    if (interp->refcnt > 1) { /* Why not abort if refcnt <= 0? */
         --interp->refcnt;
         MP_TRACE_i(MP_FUNC, "interp=0x%lx, refcnt=%d -- interp still in use",
                    (unsigned long)interp, interp->refcnt);
         return APR_SUCCESS;
     }
+    if(!MpInterpIN_USE(interp)){
+        MP_TRACE_i(MP_FUNC, "interp=0x%lx, refcnt=%d -- interp not in use, already unselected?",
+                   (unsigned long)interp, interp->refcnt);
+        return APR_SUCCESS;
+    }
 
-    MpInterpIN_USE_Off(interp);
+    MpInterpIN_USE_Off(interp); /* Why not zero refcnt? */
 
     modperl_thx_interp_set(interp->perl, NULL);
 #ifdef MP_DEBUG
@@ -438,8 +443,8 @@
         ccfg->interp->refcnt++;
 
         MP_TRACE_i(MP_FUNC,
-                   "found interp 0x%lx in con config, refcnt incremented to %d",
-                   (unsigned long)ccfg->interp, ccfg->interp->refcnt);
+	 "req: %pp, found interp 0x%lx in con config, refcnt incremented to %d",
+	   r, (unsigned long)ccfg->interp, ccfg->interp->refcnt);
         /* set context (THX) for this thread */
         PERL_SET_CONTEXT(ccfg->interp->perl);
         /* modperl_thx_interp_set() is not called here because the interp
@@ -449,9 +454,11 @@
     }
 
     MP_TRACE_i(MP_FUNC,
-               "fetching interp for %s:%d", s->server_hostname, s->port);
+               "req: %pp, fetching interp for %s:%d, ccfg: %pp",
+	       r, s->server_hostname, s->port, ccfg);
     interp = modperl_interp_get(s);
-    MP_TRACE_i(MP_FUNC, "  --> got %pp (perl=%pp)", interp, interp->perl);
+    MP_TRACE_i(MP_FUNC,
+      "req: %pp,   --> got %pp (perl=%pp)", r, interp, interp->perl);
     ++interp->num_requests; /* should only get here once per request */
     interp->refcnt = 0;
 
@@ -466,8 +473,8 @@
     interp->ccfg = ccfg;
 
     MP_TRACE_i(MP_FUNC,
-               "pulled interp %pp (perl=%pp) from mip, num_requests is %d",
-               interp, interp->perl, interp->num_requests);
+               "req: %pp, pulled interp %pp (perl=%pp) from mip, num_requests is %d, ccfg: %pp",
+               r, interp, interp->perl, interp->num_requests, ccfg);
 
     /*
      * if a per-dir PerlInterpScope is specified, use it.
