Skip to content
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 poll_db crash when notifications payloads indeces is None #537

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

mpaolino
Copy link

@mpaolino mpaolino commented Mar 28, 2024

Every time poll_db() tries to process a notification payload that has indices set to None it crashes.
This can happen for several reasons, outdated triggers for instance, or due to other non-tracked changes in the DB pgsync listens to. For example a TRUNCATE in a table of the same DB that pgsync monitors but does not sync.

This is generating a crash every time this happens.

This PR fixes this by adding a simple check for a None value before trying to search the payload indices list.

Adding a test is challenging because the current code does not provide a way to control/exit the db_poll thread loop, hence you cannot exit the loop from a test once started. This requires a refactor that I think is out of the scope of this fix.

BTW, you should really think about having a stable branch with the latest release, main is currently broken and tests do not pass. This makes contributions much harder for other devs because there is not simple way to verify the fixes do not introduce secondary effects. You have to checkout the tag, cherry pick the fix commit, run the tests, and then make a PR against main.

Thanks for all your hard work and dedication to this project @toluaina, it's very useful and you are much appreciated.

@mpaolino mpaolino changed the title Fix poll_db crash when processing notifications payloads indeces is None Fix poll_db crash when notifications payloads indeces is None Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant