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 payload indeces is None #537

Merged
merged 5 commits into from
Jun 11, 2024

Conversation

mpaolino
Copy link
Contributor

@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 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 no 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 very 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
@mpaolino
Copy link
Contributor Author

@toluaina is this project active?

@mpaolino mpaolino changed the title Fix poll_db crash when notifications payloads indeces is None Fix poll_db crash when notifications payload indeces is None Jun 10, 2024
Copy link
Owner

@toluaina toluaina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with thanks.

@toluaina
Copy link
Owner

@toluaina is this project active?

Apologies, I've had very important life commitments.
Yes it's is very much active.

@toluaina toluaina merged commit de81269 into toluaina:main Jun 11, 2024
@mpaolino
Copy link
Contributor Author

Thank you again!

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.

2 participants