r4481 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Mon Jan 25 14:42:04 CET 2010
Author: phk
Date: 2010-01-25 14:42:04 +0100 (Mon, 25 Jan 2010)
New Revision: 4481
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_acceptor.c
trunk/varnish-cache/bin/varnishd/cache_panic.c
trunk/varnish-cache/bin/varnishd/common.h
trunk/varnish-cache/bin/varnishd/varnishd.c
Log:
Add an ident-string to panic output, which reveals arch,os,rev and which
subsystems are used (storage/hash/waiter) but not the options given to
these.
This info is often missing in bugreports.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2010-01-25 12:19:22 UTC (rev 4480)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2010-01-25 13:42:04 UTC (rev 4481)
@@ -446,6 +446,7 @@
void vca_close_session(struct sess *sp, const char *why);
void VCA_Prep(struct sess *sp);
void VCA_Init(void);
+const char *VCA_waiter_name(void);
extern pthread_t VCA_thread;
/* cache_backend.c */
Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2010-01-25 12:19:22 UTC (rev 4480)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2010-01-25 13:42:04 UTC (rev 4481)
@@ -70,7 +70,22 @@
static struct timeval tv_sndtimeo;
static struct timeval tv_rcvtimeo;
-/*
+/*--------------------------------------------------------------------
+ * Report waiter name to panics
+ */
+
+const char *
+VCA_waiter_name(void)
+{
+
+ if (vca_act != NULL)
+ return (vca_act->name);
+ else
+ return ("no_waiter");
+}
+
+
+/*--------------------------------------------------------------------
* We want to get out of any kind of touble-hit TCP connections as fast
* as absolutely possible, so we set them LINGER enabled with zero timeout,
* so that even if there are outstanding write data on the socket, a close(2)
@@ -395,6 +410,8 @@
{
int i;
+ ASSERT_MGT();
+
if (arg == NULL) {
if (vca_act == NULL)
cli_out(cli, "default");
Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_panic.c 2010-01-25 12:19:22 UTC (rev 4480)
+++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2010-01-25 13:42:04 UTC (rev 4481)
@@ -326,6 +326,9 @@
if (q != NULL)
vsb_printf(vsp, "thread = (%s)\n", q);
+ vsb_printf(vsp, "ident = %s,%s\n",
+ vsb_data(vident) + 1, VCA_waiter_name());
+
pan_backtrace();
if (!(params->diag_bitmap & 0x2000)) {
Modified: trunk/varnish-cache/bin/varnishd/common.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/common.h 2010-01-25 12:19:22 UTC (rev 4480)
+++ trunk/varnish-cache/bin/varnishd/common.h 2010-01-25 13:42:04 UTC (rev 4481)
@@ -31,6 +31,7 @@
struct cli;
struct sockaddr;
+
extern pid_t mgt_pid;
#define ASSERT_MGT() do { assert(getpid() == mgt_pid);} while (0)
@@ -46,6 +47,7 @@
/* varnishd.c */
struct vsb;
+extern struct vsb *vident;
int Symbol_Lookup(struct vsb *vsb, void *ptr);
#define TRUST_ME(ptr) ((void*)(uintptr_t)(ptr))
Modified: trunk/varnish-cache/bin/varnishd/varnishd.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/varnishd.c 2010-01-25 12:19:22 UTC (rev 4480)
+++ trunk/varnish-cache/bin/varnishd/varnishd.c 2010-01-25 13:42:04 UTC (rev 4481)
@@ -49,6 +49,8 @@
#include <time.h>
#include <unistd.h>
+#include <sys/utsname.h>
+
#include "compat/daemon.h"
#ifndef HAVE_STRLCPY
@@ -81,7 +83,22 @@
pid_t mgt_pid;
struct vev_base *mgt_evb;
int exit_status = 0;
+struct vsb *vident;
+static void
+build_vident(void)
+{
+ struct utsname uts;
+
+ vident = vsb_newauto();
+ AN(vident);
+ if (!uname(&uts)) {
+ vsb_printf(vident, ",%s", uts.sysname);
+ vsb_printf(vident, ",%s", uts.release);
+ vsb_printf(vident, ",%s", uts.machine);
+ }
+}
+
/*--------------------------------------------------------------------*/
static void *
@@ -132,6 +149,7 @@
priv = pick(STV_choice, av[1], "storage");
AN(priv);
+ vsb_printf(vident, ",-s%s", av[1]);
STV_add(priv, ac, av + 2);
@@ -161,6 +179,7 @@
hp = pick(hsh_choice, av[1], "hash");
CHECK_OBJ_NOTNULL(hp, SLINGER_MAGIC);
+ vsb_printf(vident, ",-h%s", av[1]);
heritage.hash = hp;
if (hp->init != NULL)
hp->init(ac, av + 2);
@@ -526,6 +545,8 @@
setbuf(stdout, NULL);
setbuf(stderr, NULL);
+ build_vident();
+
Symbol_hack(argv[0]);
/* for ASSERT_MGT() */
@@ -734,6 +755,9 @@
VSL_MgtInit(SHMLOG_FILENAME, l_size);
+ vsb_finish(vident);
+ AZ(vsb_overflowed(vident));
+
if (d_flag == 1)
DebugStunt();
if (d_flag < 2 && !F_flag)
@@ -744,6 +768,9 @@
if (pfh != NULL && vpf_write(pfh))
fprintf(stderr, "NOTE: Could not write PID file\n");
+ if (d_flag > 0)
+ fprintf(stderr, "Varnish on %s\n", vsb_data(vident) + 1);
+
/* Do this again after debugstunt and daemon has run */
mgt_pid = getpid();
More information about the varnish-commit
mailing list