Skip to content

refs #14665 - donate-cpu-server.py: improved handling of corrupt package-index.txt#8442

Open
firewave wants to merge 1 commit intocppcheck-opensource:mainfrom
firewave:daca-pkg-idx
Open

refs #14665 - donate-cpu-server.py: improved handling of corrupt package-index.txt#8442
firewave wants to merge 1 commit intocppcheck-opensource:mainfrom
firewave:daca-pkg-idx

Conversation

@firewave
Copy link
Copy Markdown
Collaborator

No description provided.

danmar
danmar previously approved these changes Apr 16, 2026
@sonarqubecloud
Copy link
Copy Markdown

@firewave firewave changed the title fixed #14665 - donate-cpu-server.py: improved handling of corrupt package-index.txt refs #14665 - donate-cpu-server.py: improved handling of corrupt package-index.txt Apr 24, 2026
@firewave
Copy link
Copy Markdown
Collaborator Author

This will only help with the server staying up but since we hit this issue a lot recently (it is down again) we will never be able to analyze all the packages if it keeps resetting the index. We really need to determine what is causing this or use a safer save method (locking? save in intervals?).

@danmar
Copy link
Copy Markdown
Collaborator

danmar commented Apr 24, 2026

This will only help with the server staying up but since we hit this issue a lot recently (it is down again) we will never be able to analyze all the packages if it keeps resetting the index. We really need to determine what is causing this or use a safer save method (locking? save in intervals?).

Yes that is true. if this happened once in a year it would be fine to just reset.

try:
packageIndex = int(f.read())
except ValueError as e:
logging.error("failed to convert package index to int", exc_info=sys.exc_info())
Copy link
Copy Markdown
Collaborator

@danmar danmar Apr 26, 2026

Choose a reason for hiding this comment

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

If reading the file fails I would suggest that we set the default value packageIndex = int(time.time()) % len(packages)

that way if the file gets corrupt frequently we will still analyze files here and there and don't always start from 0. It's not perfect but better imho.

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