Skip to content

Commit

Permalink
Merge pull request #4909 from MrAnno/fix-otel-reload
Browse files Browse the repository at this point in the history
Fix gRPC reload
  • Loading branch information
MrAnno authored Apr 19, 2024
2 parents 5f171d8 + 27ac7b7 commit 41209bf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion lib/filterx/filterx-object.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ filterx_type_init(FilterXType *type)
INIT_TYPE_METHOD(type, dict_factory);
INIT_TYPE_METHOD(type, repr);
INIT_TYPE_METHOD(type, free_fn);
g_assert(filterx_type_register(type->name, type));

if (!filterx_type_register(type->name, type))
msg_error("Reregistering filterx type", evt_tag_str("name", type->name));
}

#define FILTERX_OBJECT_MAGIC_BIAS G_MAXINT32
Expand Down
16 changes: 11 additions & 5 deletions modules/grpc/otel/filterx/object-otel.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,17 @@ FILTERX_DECLARE_TYPE(otel_array);
static inline void
otel_filterx_objects_global_init(void)
{
filterx_type_init(&FILTERX_TYPE_NAME(otel_logrecord));
filterx_type_init(&FILTERX_TYPE_NAME(otel_resource));
filterx_type_init(&FILTERX_TYPE_NAME(otel_scope));
filterx_type_init(&FILTERX_TYPE_NAME(otel_kvlist));
filterx_type_init(&FILTERX_TYPE_NAME(otel_array));
static gboolean initialized = FALSE;

if (!initialized)
{
filterx_type_init(&FILTERX_TYPE_NAME(otel_logrecord));
filterx_type_init(&FILTERX_TYPE_NAME(otel_resource));
filterx_type_init(&FILTERX_TYPE_NAME(otel_scope));
filterx_type_init(&FILTERX_TYPE_NAME(otel_kvlist));
filterx_type_init(&FILTERX_TYPE_NAME(otel_array));
initialized = TRUE;
}
}

#include "compat/cpp-end.h"
Expand Down
1 change: 1 addition & 0 deletions news/bugfix-4909.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
gRPC drivers: fixed a crash when gRPC drivers were used and syslog-ng was reloaded

0 comments on commit 41209bf

Please sign in to comment.