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: prevent reboot loops #345

Merged
merged 1 commit into from
Dec 19, 2024
Merged

fix: prevent reboot loops #345

merged 1 commit into from
Dec 19, 2024

Conversation

fnesveda
Copy link
Member

We can't use Actor.reboot() inside a migrating event handler, because it internally calls all the handlers for the migrating event, so calling that on the migrating event would get into an infinite loop. This fixes it by allowing the reboot to be called only once.

@fnesveda fnesveda added adhoc Ad-hoc unplanned task added during the sprint. t-platform Issues with this label are in the ownership of the platform team. labels Dec 18, 2024
@fnesveda fnesveda added this to the 105th sprint - Platform Team milestone Dec 18, 2024
@fnesveda fnesveda requested review from janbuchar and B4nan December 18, 2024 12:42
@fnesveda fnesveda self-assigned this Dec 18, 2024
Copy link
Contributor

@janbuchar janbuchar left a comment

Choose a reason for hiding this comment

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

LGTM, @B4nan should probably see this as well

@fnesveda fnesveda merged commit 271bc99 into master Dec 19, 2024
9 checks passed
@fnesveda fnesveda deleted the fix/prevent-multiple-reboots branch December 19, 2024 15:04
fnesveda added a commit to apify/apify-sdk-python that referenced this pull request Dec 20, 2024
…oot behavior with JS SDK (#361)

This fixes several issues with the `Actor.reboot()` behavior:
- `Actor.reboot()` waits for all event handlers to finish, but if itself
it was called in an event handler, it would be waiting for itself,
getting into a deadlock
- `Actor.reboot()` in the JS SDK triggers event handlers for the
`migrating` and `persistState` events, but in the Python SDK it was
triggering only the `persistState` handlers

This aligns the behavior to work like the JS SDK, and prevents reboot
getting into an infinite loop by allowing it to be called only once.

Related PR in JS SDK: apify/apify-sdk-js#345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
adhoc Ad-hoc unplanned task added during the sprint. t-platform Issues with this label are in the ownership of the platform team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants