[master] 2165342 Add panic dump facility for threads which have a busyobj rather than a req.

Poul-Henning Kamp phk at varnish-cache.org
Tue May 14 11:10:05 CEST 2013


commit 21653426c21010ac5c226f50940d8afca9032962
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue May 14 09:09:33 2013 +0000

    Add panic dump facility for threads which have a busyobj rather than a req.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index aa83773..d7f29f5 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -913,6 +913,8 @@ uint32_t VXID_Get(struct vxid_pool *v);
 extern volatile struct params * cache_param;
 void THR_SetName(const char *name);
 const char* THR_GetName(void);
+void THR_SetBusyobj(const struct busyobj *);
+struct busyobj * THR_GetBusyobj(void);
 void THR_SetRequest(const struct req *);
 struct req * THR_GetRequest(void);
 
diff --git a/bin/varnishd/cache/cache_main.c b/bin/varnishd/cache/cache_main.c
index dfdbfa5..0aaf8b9 100644
--- a/bin/varnishd/cache/cache_main.c
+++ b/bin/varnishd/cache/cache_main.c
@@ -52,6 +52,21 @@ volatile struct params	*cache_param;
  */
 
 static pthread_key_t req_key;
+static pthread_key_t bo_key;
+
+void
+THR_SetBusyobj(const struct busyobj *bo)
+{
+
+	AZ(pthread_setspecific(bo_key, bo));
+}
+
+struct busyobj *
+THR_GetBusyobj(void)
+{
+
+	return (pthread_getspecific(bo_key));
+}
 
 void
 THR_SetRequest(const struct req *req)
diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c
index 14c14b3..824c53a 100644
--- a/bin/varnishd/cache/cache_panic.c
+++ b/bin/varnishd/cache/cache_panic.c
@@ -396,6 +396,7 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
 {
 	const char *q;
 	struct req *req;
+	struct busyobj *bo;
 
 	AZ(pthread_mutex_lock(&panicstr_mtx)); /* Won't be released,
 						  we're going to die
@@ -446,6 +447,11 @@ pan_ic(const char *func, const char *file, int line, const char *cond,
 			pan_req(req);
 			VSL_Flush(req->vsl, 0);
 		}
+		bo = THR_GetBusyobj();
+		if (bo != NULL) {
+			pan_busyobj(bo);
+			VSL_Flush(bo->vsl, 0);
+		}
 	}
 	VSB_printf(pan_vsp, "\n");
 	VSB_bcat(pan_vsp, "", 1);	/* NUL termination */



More information about the varnish-commit mailing list