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: handle init failure on incorrect current event #2494

Merged
merged 1 commit into from
May 5, 2024

Conversation

kamil-certat
Copy link
Contributor

If event hold in current event wasn't saved correctly, the bot is unable to start and handle any event.

In our case, the file wasn't created at all. I'm not sure yet why (I suspect some trouble by reloading), but such a problem shouldn't stop the bot from working.

If event hold in current event wasn't saved correctly,
the bot is unable to start and handle any event.
self.min_time_current = last_min_time
self.max_time_current = last_max_time
except:
self.logger.exception("Loading current event %s failed. Skipping it.", self.current_event)
Copy link
Member

Choose a reason for hiding this comment

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

Is it really OK to drop events if there was a failure?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not dropping anything, as long as I didn't missed anything. This bot is making a new MISP event periodically, and writing incoming IntelMQ events in the same event. Every time they are saved to the file with the MISP event. The current_event is just a reference to the current MISP event, and if we don't load the current (actually: the last one created), the bot creates a new one and save data there. Old data, if they exist, are not lost.

In my case, the pointer to the current MISP event was pointing to not-existing file. When I still need to understand why, as long as we don't have atomic saving to the disk, it may happen (e.g. crash between saving the pointer file and the actual event file)

@sebix sebix added this to the 3.3.1 milestone May 5, 2024
@sebix sebix merged commit 861a202 into certtools:develop May 5, 2024
20 checks passed
@kamil-certat kamil-certat deleted the handle_current_event_fail branch May 6, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants