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: server crash when accepting improper resource create request #374

Merged
merged 2 commits into from
Jun 6, 2022

Conversation

irainia
Copy link
Member

@irainia irainia commented May 25, 2022

This PR is to address #352 . Even though the issue only mentioned about resource creation, but this solution should also address the same for updating resource. This is because the update process is similar to the creation.

Changes

The followings are the changes done:

  • update adapter to add further validation
  • create the unit test to address such implementation
  • update mock implementation to address the requirement

Improvement

Based on this PR, there are some TODO that can be addressed through separate cards, as the changes might be bigger.

  • add validation on the adapter initialization
  • add more unit test on the adapter to address more cases
  • update mock implementation to address two points above
  • finding out the similar case where the server could crash based on the request from the user

@coveralls
Copy link

coveralls commented May 25, 2022

Pull Request Test Coverage Report for Build 2425899844

  • 10 of 10 (100.0%) changed or added relevant lines in 1 file are covered.
  • 3 unchanged lines in 1 file lost coverage.
  • Overall coverage increased (+0.06%) to 75.045%

Files with Coverage Reduction New Missed Lines %
job/deploy_manager.go 3 90.2%
Totals Coverage Status
Change from base Build 2382360239: 0.06%
Covered Lines: 6267
Relevant Lines: 8351

💛 - Coveralls

@sravankorumilli sravankorumilli linked an issue May 25, 2022 that may be closed by this pull request
@irainia irainia force-pushed the fix-create-resource-crash branch from a6669ac to e72edc7 Compare May 25, 2022 11:14
@@ -442,14 +443,24 @@ func ToResourceProto(spec models.ResourceSpec) (*pb.ResourceSpecification, error
}

func FromResourceProto(spec *pb.ResourceSpecification, storeName string, datastoreRepo models.DatastoreRepo) (models.ResourceSpec, error) {
if spec == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

@irainia cmiiw, because these flows are not handled, it is panicing and server is crashing is it? Just want to check ideally the panic should just kill the goroutine handling the request not the entire server, can we cross check on this, as this means this issue can happen even in the future for all unhandled scenarios.

Copy link
Member Author

Choose a reason for hiding this comment

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

@sravankorumilli , yes, it cashed because of panic. But, we didn't explicitly call any go routine to run it (such as this).

Copy link
Contributor

Choose a reason for hiding this comment

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

@irainia we can use middleware as per this to recover from panics

Copy link
Member Author

Choose a reason for hiding this comment

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

updated and tested based on the suggestion

@arinda-arif
Copy link
Contributor

LGTM, although seeing a similar issue on job creation. We can consider fixing that in this or new PR should also be fine.

@sravankorumilli sravankorumilli merged commit 3a4ea5e into main Jun 6, 2022
@sravankorumilli sravankorumilli deleted the fix-create-resource-crash branch June 6, 2022 03:28
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.

server crash when creating resource
4 participants