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 python persist crash if there is no global python block #4572
Merged
MrAnno
merged 13 commits into
syslog-ng:master
from
bazsi:fix-python-persist-crash-if-there-is-no-global-python-block
Aug 9, 2023
Merged
Fix python persist crash if there is no global python block #4572
MrAnno
merged 13 commits into
syslog-ng:master
from
bazsi:fix-python-persist-crash-if-there-is-no-global-python-block
Aug 9, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Build FAILURE |
MrAnno
force-pushed
the
fix-python-persist-crash-if-there-is-no-global-python-block
branch
3 times, most recently
from
August 9, 2023 08:13
7450d87
to
25bb1a3
Compare
Build FAILURE |
The PythonBinding class encapsulates the basic parameters for interacting with the Python object that contains the parsing logic. It will also allow centralizing python related functionality across all of our python components (e.g. destination, source, etc) Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
python-main contains multiple logical layers, let's split them. Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
…block Signed-off-by: Balazs Scheidler <balazs.scheidler@axoflow.com>
Signed-off-by: László Várady <laszlo.varady@anno.io>
MrAnno
force-pushed
the
fix-python-persist-crash-if-there-is-no-global-python-block
branch
from
August 9, 2023 09:57
25bb1a3
to
4b1ac53
Compare
MrAnno
changed the title
WIP: Fix python persist crash if there is no global python block
Fix python persist crash if there is no global python block
Aug 9, 2023
MrAnno
previously approved these changes
Aug 9, 2023
Signed-off-by: László Várady <laszlo.varady@anno.io>
MrAnno
approved these changes
Aug 9, 2023
Thanks @MrAnno for finishing this up. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a refactor + a bugfix for a crash in our Python bindings, which happen in the configuration is using a Persist or a LogTemplate and there's no global python code block in the configuration anywhere.
The crash happens because if there's no global code block, our main module is never initialized. And this main module is what encapsulates the Python -> GlobalConfig association.
I found that there was no easy way to add the initialization of our main module, it was only driven from the grammar. Instead of adding yet another initialization to all our Python based components, I introduced PythonBinding a class shared by all our components and where I could add the relevant initialization.
I also split the python-main.c module into 3 files (python-startup, python-global and python-main) to make the size easier to manage.
This is WIP at the moment, as it's pretty late already and I am yet to do some testing myself. There's no NEWS file either.
This should fix the issue encountered by @ryanfaircloth
To trigger the crash, use a Python based source, with a Persist() instance so that you store the Python code in an external module and you DON'T have any global python code blocks.
The crash should happen as soon as the Persist() object is initialized.