Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: add constraint and runtime check for provisioner logs size limit#18893

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
bcpeinhardt wants to merge9 commits intomain
base:main
Choose a base branch
Loading
frombcpeinhardt/17992-fix-startup-logs-size-limit-bug

Conversation

bcpeinhardt
Copy link
Contributor

@bcpeinhardtbcpeinhardt commentedJul 15, 2025
edited
Loading

WIP, lovely PR description imminent.

@bcpeinhardtbcpeinhardt changed the titlebcpeinhardt/17992 fix startup logs size limit bugfix: 17992 startup logs size limit bugJul 15, 2025
@bcpeinhardtbcpeinhardt changed the titlefix: 17992 startup logs size limit bugfix: add constraint and runtime check for provisioner logs size limitJul 15, 2025
Comment on lines +941 to +960
err = s.Database.UpdateProvisionerJobLogsLength(ctx, database.UpdateProvisionerJobLogsLengthParams{
ID: parsedID,
LogsLength: int32(newLogSize), // #nosec G115 - Log output length is limited to 1MB (2^20) which fits in an int32.
})
if err != nil {
if database.IsProvisionerJobLogsLimitError(err) {
err = s.Database.UpdateProvisionerJobLogsOverflowed(ctx, database.UpdateProvisionerJobLogsOverflowedParams{
ID: parsedID,
LogsOverflowed: true,
})
if err != nil {
s.Logger.Error(ctx, "failed to set logs overflowed flag", slog.F("job_id", parsedID), slog.Error(err))
}
return &proto.UpdateJobResponse{
Canceled: job.CanceledAt.Valid,
}, nil
}
s.Logger.Error(ctx, "failed to update logs length", slog.F("job_id", parsedID), slog.Error(err))
return nil, xerrors.Errorf("update logs length: %w", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it might be a good idea to store the current logs length and overflow state as variables in this Go code. With that change we would update the length var when anInsert call is successful, and we can determine prior to insertion whether the log we want to insert will cause the overflow. That way we can avoid the extras.Database.UpdateProvisionerJobLogsLength call on every log line after an overflow has occurred.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@cstyancstyancstyan left review comments

@aslilacaslilacAwaiting requested review from aslilacaslilac will be requested when the pull request is marked ready for reviewaslilac is a code owner

At least 1 approving review is required to merge this pull request.

Assignees

@bcpeinhardtbcpeinhardt

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@bcpeinhardt@cstyan

[8]ページ先頭

©2009-2025 Movatter.jp