-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX: load pipeline configurations before connecting #2034
Conversation
2368151
to
1bd8955
Compare
Codecov Report
@@ Coverage Diff @@
## develop #2034 +/- ##
===========================================
- Coverage 76.00% 75.96% -0.05%
===========================================
Files 425 425
Lines 22845 22842 -3
Branches 3039 3039
===========================================
- Hits 17364 17352 -12
- Misses 4775 4780 +5
- Partials 706 710 +4
|
Under which circumstances did you encounter this bug? |
I'm not fully certain at the moment, actually. |
A comment in |
Still debugging... In 56df092 I rewrote the redis test to better match the behavior in Bot, using the same methods and arguments. If I set a different host (e.g. with |
In case you are unable to reproduce it, I can test out whatever you want. diff --git a/intelmq/lib/pipeline.py b/intelmq/lib/pipeline.py
index 6c276b0f..e0933856 100644
--- a/intelmq/lib/pipeline.py
+++ b/intelmq/lib/pipeline.py
@@ -57,6 +57,8 @@ def create(logger, broker=None, direction=None, queues=None, pipeline_args=None,
broker = broker.title()
else:
broker = "Redis"
+
+ logger.info(f'{queues=} {direction=}')
pipe = getattr(intelmq.lib.pipeline, broker)(logger=logger, pipeline_args=pipeline_args, load_balance=load_balance, is_multithreaded=is_multithreaded)
if queues and not direction:
raise ValueError("Parameter 'direction' must be given when using " I got the following lines in a bot's log file, when attempting to start it:
So it appears to happen with the destination queue specifically, and retrying it a couple of times gives identical log lines. |
I just got it reproduced locally, with an output bot, as you said. |
In Line 570 in fb03ccc
the check is is not None . The empty default value is:Line 67 in fb03ccc
also None . However, something between sets the variable to an empty dict, which is not None and then the bot tries to connect to nothing.Haven't found that code yet, but maybe an empty dict is a better default value anyway, also because it is assumed in the code, e.g. here: Line 392 in fb03ccc
|
Ah, that's the loading of the runtime configuration. That makes sense. If the variable is not defined, the error does not occur, but if the configuration has for example:
Then it occurs. |
Sounds like it's related to some of the changes I've made in the manager then. |
And, indeed, I have
|
I favour the second option, which is also simple fixable. The core should handle any valid configuration, independent of the tool which created the config. Such a config could also be written by a human. @schacht-certat What's your opinion? |
Yes, handling this in intelmq itself is the better option, |
the manager (or any user in the file directly) sets destination_queues to an empty dict. the check `is not None` did not catch empty dicts, initializing the destination pipeline even when no queues were defined. The check is now more lax and the code handles empty dicts normally, making them also the default value instead of None. fixes #2034
based on what we found out here in this thread, i created #2051 with a smaller change |
Fixed properly by #2051 |
the manager (or any user in the file directly) sets destination_queues to an empty dict. the check `is not None` did not catch empty dicts, initializing the destination pipeline even when no queues were defined. The check is now more lax and the code handles empty dicts normally, making them also the default value instead of None. fixes #2034
This appears to fix an issue where the
host
attribute of the pipeline is not set before being accessed while connecting pipelines, causing a bot to fail to start, as shown in this stack trace: