detect stopped cgroups immediately
Costa Tsaousis (ktsaou) committed
Mar 1, 2017 at 19:54 UTC
168996d45a438651e8893c2763fce0e42437cfec
2 files changed
+13
-2
src/rrdpush.c
+1
-1
@@ -453,7 +453,7 @@ cleanup:
453
454
if(pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL) != 0)
455
error("STREAM %s [send]: cannot set pthread cancel state to ENABLE.", host->hostname);
456
-
456
+
457
pthread_exit(NULL);
458
return NULL;
459
}
src/sys_fs_cgroup.c
+12
-1
@@ -51,6 +51,8 @@ static SIMPLE_PATTERN *systemd_services_cgroups = NULL;
51
52
static char *cgroups_rename_script = NULL;
53
54
+static int cgroups_check = 0;
55
+
56
static uint32_t Read_hash = 0;
57
static uint32_t Write_hash = 0;
58
static uint32_t user_hash = 0;
@@ -407,12 +409,14 @@ static inline void cgroup_read_cpuacct_stat(struct cpuacct_stat *cp) {
409
ff = procfile_reopen(ff, cp->filename, NULL, PROCFILE_FLAG_DEFAULT);
410
if(unlikely(!ff)) {
411
cp->updated = 0;
412
+ cgroups_check = 1;
413
return;
414
}
415
416
ff = procfile_readall(ff);
417
if(unlikely(!ff)) {
418
cp->updated = 0;
419
+ cgroups_check = 1;
420
return;
421
}
422
@@ -449,12 +453,14 @@ static inline void cgroup_read_cpuacct_usage(struct cpuacct_usage *ca) {
453
ff = procfile_reopen(ff, ca->filename, NULL, PROCFILE_FLAG_DEFAULT);
454
if(unlikely(!ff)) {
455
ca->updated = 0;
456
+ cgroups_check = 1;
457
return;
458
}
459
460
ff = procfile_readall(ff);
461
if(unlikely(!ff)) {
462
ca->updated = 0;
463
+ cgroups_check = 1;
464
return;
465
}
466
@@ -509,12 +515,14 @@ static inline void cgroup_read_blkio(struct blkio *io) {
515
ff = procfile_reopen(ff, io->filename, NULL, PROCFILE_FLAG_DEFAULT);
516
if(unlikely(!ff)) {
517
io->updated = 0;
518
+ cgroups_check = 1;
519
return;
520
}
521
522
ff = procfile_readall(ff);
523
if(unlikely(!ff)) {
524
io->updated = 0;
525
+ cgroups_check = 1;
526
return;
527
}
528
@@ -580,12 +588,14 @@ static inline void cgroup_read_memory(struct memory *mem) {
588
ff = procfile_reopen(ff, mem->filename_detailed, NULL, PROCFILE_FLAG_DEFAULT);
589
if(unlikely(!ff)) {
590
mem->updated_detailed = 0;
591
+ cgroups_check = 1;
592
goto memory_next;
593
}
594
595
ff = procfile_readall(ff);
596
if(unlikely(!ff)) {
597
mem->updated_detailed = 0;
598
+ cgroups_check = 1;
599
goto memory_next;
600
}
601
@@ -2516,9 +2526,10 @@ void *cgroups_main(void *ptr) {
2526
// BEGIN -- the job to be done
2527
2528
find_dt += hb_dt;
2519
- if(unlikely(find_dt >= find_every)) {
2529
+ if(unlikely(find_dt >= find_every || cgroups_check)) {
2530
find_all_cgroups();
2531
find_dt = 0;
2532
+ cgroups_check = 0;
2533
}
2534
2535
read_all_cgroups(cgroup_root);