-
Notifications
You must be signed in to change notification settings - Fork 80
Fix server error when submitting on non-existent project #3304
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
base: master
Are you sure you want to change the base?
Conversation
williamjallen
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simply relocating the check is not a robust fix. Instead, it would be better to check the return value of $this->project->FindByName($projectname); and use $this->failProcessing() to return an appropriate error if the project does not exist.
That makes sense, thank you for the feedback! I made the requested changes. Please feel free to take the wheel, as I'm not too experienced with either the CDash codebase or php. |
| } elseif (intval($this->project->Id) < 1) { | ||
| Log::info("Rejected submission with invalid project name: $projectname"); | ||
| $this->failProcessing($filename, Response::HTTP_NOT_FOUND, 'The requested project does not exist.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thinking about this a bit more, why doesn't this catch the error? Can you post the stack trace for the error you're experiencing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That place is never reached, as an exception is thrown in this function, called a few lines before that:
| $this->project->CheckForTooManyBuilds(); |
CDash/app/cdash/app/Model/Project.php
Lines 611 to 615 in b1bc0f0
| public function CheckForTooManyBuilds(): bool | |
| { | |
| if (!$this->Id) { | |
| throw new RuntimeException('ID not set for project'); | |
| } |
I also wanted to post the logging output, but I cannot get it to work (storage/logs/cdash.log is empty)
Previously, if a submission happened on a non-existent project, the
CheckForTooManyBuilds()would result in a 500 http code, which caused me some confusion.Thanks!