Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ktsaou committed Oct 21, 2023
2 parents fd0c2bb + babb3c1 commit b8f7f10
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions daemon/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,7 @@ void netdata_cleanup_and_exit(int ret) {
error_limit_static_thread_var(erl, 1, 100 * USEC_PER_MS);
error_limit(&erl, "waiting for %zu collectors to finish", running);
// sleep_usec(100 * USEC_PER_MS);
cleanup_destroyed_dictionaries();
}
}

Expand Down
13 changes: 11 additions & 2 deletions libnetdata/dictionary/dictionary.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ struct dictionary {
const char *creation_function;
const char *creation_file;
size_t creation_line;
pid_t creation_tid;
#endif

usec_t last_gc_run_us;
Expand Down Expand Up @@ -1873,20 +1874,27 @@ void cleanup_destroyed_dictionaries(void) {
size_t line = dict->creation_line;
const char *file = dict->creation_file;
const char *function = dict->creation_function;
pid_t pid = dict->creation_tid;
#endif

DICTIONARY_STATS_DICT_DESTROY_QUEUED_MINUS1(dict);
if(dictionary_free_all_resources(dict, NULL, false)) {

internal_error(
true,
"DICTIONARY: freed dictionary with delayed destruction, created from %s() %zu@%s.",
function, line, file);
"DICTIONARY: freed dictionary with delayed destruction, created from %s() %zu@%s pid %d.",
function, line, file, pid);

if(last) last->next = next;
else dictionaries_waiting_to_be_destroyed = next;
}
else {

internal_error(
true,
"DICTIONARY: cannot free dictionary with delayed destruction, created from %s() %zu@%s pid %d.",
function, line, file, pid);

DICTIONARY_STATS_DICT_DESTROY_QUEUED_PLUS1(dict);
last = dict;
}
Expand Down Expand Up @@ -2085,6 +2093,7 @@ DICTIONARY *dictionary_create_view(DICTIONARY *master) {
dict->creation_function = function;
dict->creation_file = file;
dict->creation_line = line;
dict->creation_tid = gettid();
#endif

DICTIONARY_STATS_DICT_CREATIONS_PLUS1(dict);
Expand Down
2 changes: 2 additions & 0 deletions libnetdata/dictionary/dictionary.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ void dictionary_version_increment(DICTIONARY *dict);

void dictionary_garbage_collect(DICTIONARY *dict);

void cleanup_destroyed_dictionaries(void);

// ----------------------------------------------------------------------------
// Set an item in the dictionary
//
Expand Down

0 comments on commit b8f7f10

Please sign in to comment.