Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
fdf06b4b
Commit
fdf06b4b
authored
Jun 24, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let directors and backends do their own panic dumps.
parent
7c898d1d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
20 deletions
+70
-20
cache_backend.c
bin/varnishd/cache/cache_backend.c
+32
-0
cache_director.c
bin/varnishd/cache/cache_director.c
+16
-0
cache_director.h
bin/varnishd/cache/cache_director.h
+4
-0
cache_panic.c
bin/varnishd/cache/cache_panic.c
+18
-20
No files found.
bin/varnishd/cache/cache_backend.c
View file @
fdf06b4b
...
...
@@ -277,6 +277,7 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
int
i
;
struct
backend
*
bp
;
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CHECK_OBJ_NOTNULL
(
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
bo
,
BUSYOBJ_MAGIC
);
CAST_OBJ_NOTNULL
(
bp
,
d
->
priv
,
BACKEND_MAGIC
);
...
...
@@ -294,6 +295,36 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo)
/*--------------------------------------------------------------------*/
static
void
vbe_panic
(
const
struct
director
*
d
,
struct
vsb
*
vsb
)
{
struct
backend
*
bp
;
CHECK_OBJ_NOTNULL
(
d
,
DIRECTOR_MAGIC
);
CAST_OBJ_NOTNULL
(
bp
,
d
->
priv
,
BACKEND_MAGIC
);
VSB_printf
(
vsb
,
" display_name = %s
\n
"
,
bp
->
display_name
);
if
(
bp
->
ipv4_addr
!=
NULL
)
VSB_printf
(
vsb
,
" ipv4 = %s
\n
"
,
bp
->
ipv4_addr
);
if
(
bp
->
ipv6_addr
!=
NULL
)
VSB_printf
(
vsb
,
" ipv6 = %s
\n
"
,
bp
->
ipv6_addr
);
VSB_printf
(
vsb
,
" port = %s
\n
"
,
bp
->
port
);
VSB_printf
(
vsb
,
" hosthdr = %s
\n
"
,
bp
->
hosthdr
);
VSB_printf
(
vsb
,
" health=%s, admin_health="
,
bp
->
healthy
?
"healthy"
:
"sick"
);
if
(
bp
->
admin_health
==
ah_probe
)
VSB_printf
(
vsb
,
"probe"
);
else
if
(
bp
->
admin_health
==
ah_sick
)
VSB_printf
(
vsb
,
"sick"
);
else
if
(
bp
->
admin_health
==
ah_healthy
)
VSB_printf
(
vsb
,
"healthy"
);
else
VSB_printf
(
vsb
,
"*invalid*"
);
VSB_printf
(
vsb
,
", changed=%.1f
\n
"
,
bp
->
health_changed
);
}
/*--------------------------------------------------------------------*/
void
VBE_fill_director
(
struct
backend
*
be
)
{
...
...
@@ -312,4 +343,5 @@ VBE_fill_director(struct backend *be)
d
->
getbody
=
vbe_dir_getbody
;
d
->
getip
=
vbe_dir_getip
;
d
->
finish
=
vbe_dir_finish
;
d
->
panic
=
vbe_panic
;
}
bin/varnishd/cache/cache_director.c
View file @
fdf06b4b
...
...
@@ -178,3 +178,19 @@ VDI_Healthy(const struct director *d, const struct busyobj *bo)
return
(
1
);
return
(
d
->
healthy
(
d
,
bo
,
NULL
));
}
/* Dump panic info -----------------------------------------------------
*/
void
VDI_Panic
(
const
struct
director
*
d
,
struct
vsb
*
vsb
,
const
char
*
nm
)
{
if
(
d
==
NULL
)
return
;
VSB_printf
(
vsb
,
" %s = %p {
\n
"
,
nm
,
d
);
VSB_printf
(
vsb
,
" vcl_name = %s
\n
"
,
d
->
vcl_name
);
VSB_printf
(
vsb
,
" name = %s
\n
"
,
d
->
name
);
if
(
d
->
panic
!=
NULL
)
d
->
panic
(
d
,
vsb
);
VSB_printf
(
vsb
,
" }
\n
"
);
}
bin/varnishd/cache/cache_director.h
View file @
fdf06b4b
...
...
@@ -61,6 +61,8 @@ typedef void vdi_finish_f(const struct director *, struct worker *,
typedef
void
vdi_http1pipe_f
(
const
struct
director
*
,
struct
req
*
,
struct
busyobj
*
);
typedef
void
vdi_panic_f
(
const
struct
director
*
,
struct
vsb
*
);
struct
director
{
unsigned
magic
;
#define DIRECTOR_MAGIC 0x3336351d
...
...
@@ -73,6 +75,7 @@ struct director {
vdi_getbody_f
*
getbody
;
vdi_getip_f
*
getip
;
vdi_finish_f
*
finish
;
vdi_panic_f
*
panic
;
void
*
priv
;
const
void
*
priv2
;
};
...
...
@@ -88,3 +91,4 @@ void VDI_Finish(struct worker *wrk, struct busyobj *bo);
int
VDI_Http1Pipe
(
struct
req
*
,
struct
busyobj
*
);
int
VDI_Healthy
(
const
struct
director
*
,
const
struct
busyobj
*
);
void
VDI_Panic
(
const
struct
director
*
,
struct
vsb
*
,
const
char
*
nm
);
bin/varnishd/cache/cache_panic.c
View file @
fdf06b4b
...
...
@@ -46,7 +46,6 @@
#include "vrt.h"
#include "cache_director.h"
#include "cache_backend.h"
#include "storage/storage.h"
#include "vcli_priv.h"
...
...
@@ -145,16 +144,12 @@ pan_ws(const struct ws *ws, int indent)
/*--------------------------------------------------------------------*/
static
void
pan_
vbc
(
const
struct
vbc
*
vb
c
)
pan_
htc
(
const
struct
http_conn
*
ht
c
)
{
struct
backend
*
be
;
be
=
vbc
->
backend
;
VSB_printf
(
pan_vsp
,
" backend = %p fd = %d {
\n
"
,
be
,
vbc
->
fd
);
VSB_printf
(
pan_vsp
,
" display_name =
\"
%s
\"
,
\n
"
,
be
->
display_name
);
VSB_printf
(
pan_vsp
,
" },
\n
"
);
VSB_printf
(
pan_vsp
,
" http_conn = %p {
\n
"
,
htc
);
VSB_printf
(
pan_vsp
,
" fd = %d,
\n
"
,
htc
->
fd
);
VSB_printf
(
pan_vsp
,
" },
\n
"
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -309,15 +304,15 @@ pan_busyobj(const struct busyobj *bo)
VSB_printf
(
pan_vsp
,
" busyobj = %p {
\n
"
,
bo
);
pan_ws
(
bo
->
ws
,
4
);
VSB_printf
(
pan_vsp
,
" refcnt = %u
\n
"
,
bo
->
refcount
);
VSB_printf
(
pan_vsp
,
" retries = %d
\n
"
,
bo
->
retries
);
VSB_printf
(
pan_vsp
,
" failed = %d
\n
"
,
bo
->
vfc
->
failed
);
VSB_printf
(
pan_vsp
,
" state = %d
\n
"
,
(
int
)
bo
->
state
);
VSB_printf
(
pan_vsp
,
" flags = {
\n
"
);
#define BO_FLAG(l, r, w, d) if(bo->l) VSB_printf(pan_vsp, " " #l "\n");
VSB_printf
(
pan_vsp
,
"
refcnt = %u
\n
"
,
bo
->
refcount
);
VSB_printf
(
pan_vsp
,
"
retries = %d
\n
"
,
bo
->
retries
);
VSB_printf
(
pan_vsp
,
"
failed = %d
\n
"
,
bo
->
vfc
->
failed
);
VSB_printf
(
pan_vsp
,
"
state = %d
\n
"
,
(
int
)
bo
->
state
);
VSB_printf
(
pan_vsp
,
"
flags = {
\n
"
);
#define BO_FLAG(l, r, w, d) if(bo->l) VSB_printf(pan_vsp, "
" #l "\n");
#include "tbl/bo_flags.h"
#undef BO_FLAG
VSB_printf
(
pan_vsp
,
" }
\n
"
);
VSB_printf
(
pan_vsp
,
"
}
\n
"
);
if
(
bo
->
htc
!=
NULL
)
{
VSB_printf
(
pan_vsp
,
" bodystatus = %d (%s),
\n
"
,
...
...
@@ -331,11 +326,14 @@ pan_busyobj(const struct busyobj *bo)
vfe
->
vfp
->
name
,
(
int
)
vfe
->
closed
);
VSB_printf
(
pan_vsp
,
"
\n
"
);
}
VSB_printf
(
pan_vsp
,
" },
\n
"
);
if
(
bo
->
htc
!=
NULL
&&
bo
->
htc
->
vbc
!=
NULL
&&
VALID_OBJ
(
bo
->
htc
->
vbc
,
BACKEND_MAGIC
))
pan_vbc
(
bo
->
htc
->
vbc
);
if
(
VALID_OBJ
(
bo
->
htc
,
HTTP_CONN_MAGIC
))
pan_htc
(
bo
->
htc
);
VDI_Panic
(
bo
->
director_req
,
pan_vsp
,
"director_req"
);
if
(
bo
->
director_resp
==
bo
->
director_req
)
VSB_printf
(
pan_vsp
,
" director_resp = director_req
\n
"
);
else
VDI_Panic
(
bo
->
director_resp
,
pan_vsp
,
"director_resp"
);
if
(
bo
->
bereq
!=
NULL
&&
bo
->
bereq
->
ws
!=
NULL
)
pan_http
(
"bereq"
,
bo
->
bereq
,
4
);
if
(
bo
->
beresp
!=
NULL
&&
bo
->
beresp
->
ws
!=
NULL
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment