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
34b687e6
Commit
34b687e6
authored
Jan 14, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stop the expiry thread before closing stevedores
This should fix the panic mentioned in
309e807d
parent
4c7108b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
+26
-3
cache_expire.c
bin/varnishd/cache/cache_expire.c
+25
-3
cache_varnishd.h
bin/varnishd/cache/cache_varnishd.h
+1
-0
No files found.
bin/varnishd/cache/cache_expire.c
View file @
34b687e6
...
...
@@ -52,9 +52,11 @@ struct exp_priv {
struct
worker
*
wrk
;
struct
vsl_log
vsl
;
struct
binheap
*
heap
;
pthread_t
thread
;
};
static
struct
exp_priv
*
exphdl
;
static
int
exp_shutdown
=
0
;
/*--------------------------------------------------------------------
* Calculate an object's effective ttl time, taking req.ttl into account
...
...
@@ -332,7 +334,7 @@ exp_thread(struct worker *wrk, void *priv)
VSL_Setup
(
&
ep
->
vsl
,
NULL
,
0
);
ep
->
heap
=
binheap_new
(
NULL
,
object_cmp
,
object_update
);
AN
(
ep
->
heap
);
while
(
1
)
{
while
(
exp_shutdown
==
0
)
{
Lck_Lock
(
&
ep
->
mtx
);
oc
=
VSTAILQ_FIRST
(
&
ep
->
inbox
);
...
...
@@ -361,7 +363,7 @@ exp_thread(struct worker *wrk, void *priv)
else
tnext
=
exp_expire
(
ep
,
t
);
}
NEEDLESS
(
return
(
NULL
)
);
return
(
NULL
);
}
/*--------------------------------------------------------------------*/
...
...
@@ -378,6 +380,26 @@ EXP_Init(void)
Lck_New
(
&
ep
->
mtx
,
lck_exp
);
AZ
(
pthread_cond_init
(
&
ep
->
condvar
,
NULL
));
VSTAILQ_INIT
(
&
ep
->
inbox
);
exphdl
=
ep
;
WRK_BgThread
(
&
pt
,
"cache-exp"
,
exp_thread
,
ep
);
ep
->
thread
=
pt
;
exphdl
=
ep
;
}
void
EXP_Shutdown
(
void
)
{
struct
exp_priv
*
ep
=
exphdl
;
void
*
status
;
Lck_Lock
(
&
ep
->
mtx
);
exp_shutdown
=
1
;
AZ
(
pthread_cond_signal
(
&
ep
->
condvar
));
Lck_Unlock
(
&
ep
->
mtx
);
AN
(
ep
->
thread
);
AZ
(
pthread_join
(
ep
->
thread
,
&
status
));
AZ
(
status
);
memset
(
&
ep
->
thread
,
0
,
sizeof
ep
->
thread
);
/* XXX could cleanup more - not worth it for now */
}
bin/varnishd/cache/cache_varnishd.h
View file @
34b687e6
...
...
@@ -229,6 +229,7 @@ extern const struct vdp VDP_range;
/* cache_expire.c */
void
EXP_Init
(
void
);
void
EXP_Shutdown
(
void
);
/* cache_fetch.c */
enum
vbf_fetch_mode_e
{
...
...
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