Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
trackrdrd
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
trackrdrd
Commits
7dc62213
Commit
7dc62213
authored
Mar 03, 2013
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tarckrdrd: - bugfix/tweak worker thread restarts
- "< max threads running" is a warning, not alert
parent
9cc19c34
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
11 deletions
+29
-11
child.c
trackrdrd/src/child.c
+8
-3
trackrdrd.h
trackrdrd/src/trackrdrd.h
+1
-1
worker.c
trackrdrd/src/worker.c
+20
-7
No files found.
trackrdrd/src/child.c
View file @
7dc62213
...
...
@@ -693,7 +693,7 @@ OSL_Track(void *priv, enum VSL_tag_e tag, unsigned fd, unsigned len,
if
(
wrk_running
<
config
.
nworkers
)
{
wrk_running
=
WRK_Running
();
if
(
wrk_running
<
config
.
nworkers
)
LOG_Log
(
LOG_
ALERT
,
"%d of %d workers running"
,
wrk_running
,
LOG_Log
(
LOG_
WARNING
,
"%d of %d workers running"
,
wrk_running
,
config
.
nworkers
);
}
...
...
@@ -978,8 +978,13 @@ CHILD_Main(struct VSM_data *vd, int endless, int readconfig)
while
(
VSL_Dispatch
(
vd
,
OSL_Track
,
NULL
)
>
0
)
if
(
term
||
!
endless
)
break
;
else
if
(
WRK_Exited
()
>
0
)
WRK_Restart
();
else
if
(
WRK_Exited
()
>
0
)
{
if
((
errnum
=
WRK_Restart
())
!=
0
)
{
LOG_Log
(
LOG_ALERT
,
"Cannot restart worker threads, giving up "
"(%s)"
,
strerror
(
errnum
));
break
;
}
}
else
{
LOG_Log0
(
LOG_WARNING
,
"Log read interrupted, continuing"
);
continue
;
...
...
trackrdrd/src/trackrdrd.h
View file @
7dc62213
...
...
@@ -82,7 +82,7 @@ void PRIV_Sandbox(void);
*/
int
WRK_Init
(
void
);
void
WRK_Start
(
void
);
void
WRK_Restart
(
void
);
int
WRK_Restart
(
void
);
void
WRK_Stats
(
void
);
int
WRK_Running
(
void
);
int
WRK_Exited
(
void
);
...
...
trackrdrd/src/worker.c
View file @
7dc62213
...
...
@@ -80,6 +80,7 @@ struct worker_data_s {
unsigned
sends
;
unsigned
fails
;
unsigned
reconnects
;
unsigned
restarts
;
};
typedef
struct
worker_data_s
worker_data_t
;
...
...
@@ -315,7 +316,8 @@ WRK_Init(void)
worker_data_t
*
wrk
=
thread_data
[
i
].
wrk_data
;
wrk
->
magic
=
WORKER_DATA_MAGIC
;
wrk
->
id
=
i
+
1
;
wrk
->
deqs
=
wrk
->
waits
=
wrk
->
sends
=
wrk
->
fails
=
wrk
->
reconnects
=
0
;
wrk
->
deqs
=
wrk
->
waits
=
wrk
->
sends
=
wrk
->
fails
=
wrk
->
reconnects
=
wrk
->
restarts
=
0
;
wrk
->
state
=
WRK_NOTSTARTED
;
}
...
...
@@ -343,7 +345,7 @@ WRK_Start(void)
thread_data
[
i
].
wrk_data
));
}
void
int
WRK_Restart
(
void
)
{
worker_data_t
*
wrk
;
...
...
@@ -352,14 +354,24 @@ WRK_Restart(void)
CHECK_OBJ_NOTNULL
(
thread_data
[
i
].
wrk_data
,
WORKER_DATA_MAGIC
);
wrk
=
thread_data
[
i
].
wrk_data
;
if
(
wrk
->
state
==
WRK_EXITED
)
{
exited
--
;
AZ
(
pthread_detach
(
thread_data
[
i
].
worker
));
wrk
->
deqs
=
wrk
->
waits
=
wrk
->
sends
=
wrk
->
fails
=
wrk
->
reconnects
=
0
;
wrk
->
restarts
++
;
wrk
->
state
=
WRK_NOTSTARTED
;
AZ
(
pthread_create
(
&
thread_data
[
i
].
worker
,
NULL
,
wrk_main
,
thread_data
[
i
].
wrk_data
));
exited
--
;
if
(
pthread_create
(
&
thread_data
[
i
].
worker
,
NULL
,
wrk_main
,
wrk
)
!=
0
)
{
/* EAGAIN means we've hit a system limit trying to restart
threads, so it's time to give up. Any other errno is a
programming error.
*/
assert
(
errno
==
EAGAIN
);
return
errno
;
}
}
}
return
0
;
}
void
...
...
@@ -372,9 +384,10 @@ WRK_Stats(void)
for
(
int
i
=
0
;
i
<
config
.
nworkers
;
i
++
)
{
wrk
=
thread_data
[
i
].
wrk_data
;
LOG_Log
(
LOG_INFO
,
"Worker %d (%s): seen=%d waits=%d sent=%d reconnects=%d failed=%d"
,
"Worker %d (%s): seen=%u waits=%u sent=%u reconnects=%u "
"restarts=%u failed=%d"
,
wrk
->
id
,
statename
[
wrk
->
state
],
wrk
->
deqs
,
wrk
->
waits
,
wrk
->
sends
,
wrk
->
reconnects
,
wrk
->
fails
);
wrk
->
reconnects
,
wrk
->
restarts
,
wrk
->
fails
);
}
}
...
...
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