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

Check that Placement is not null before trying to access it #2950

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sgiacomel
Copy link

If Placement is missing after updating a service with previous placement constraints in a swarm with multiple nodes, it sends the swarm in an unrecoverable state.

closes #2947
closes moby/moby#37883

- What I did
I created a swarm with 2 nodes. I created a service using the docker api with a placement constraint. I then updated the service passing a json load with no Placement field.
moby/moby#37883 (comment)

- How I did it
I mainly used curl to issue docker api calls

- How to test it
I can provide more details

- Description for the changelog
Prevents nil pointer reference in nodeMatches when Placement is null

Signed-off-by: Simone Giacomel [email protected]

@miklos-martin
Copy link

Hi @sgiacomel, could you please rebase this PR to see if the build still fails? I believe the build failure is not connected to this change and there were some commits to master fiddling with protos since this branch was created.

Thanks in advance!

@miklos-martin
Copy link

Hi! I'd be happy to open a rebased version of this PR, in case @sgiacomel can't find the time to do it.

sgiacomel and others added 2 commits February 8, 2021 10:25
Met the requirements if the constraints are empty
@sgiacomel sgiacomel force-pushed the 2947-check-placement-not-null branch from c479e01 to 9cb517e Compare February 8, 2021 15:26
@sgiacomel
Copy link
Author

Hi! I'd be happy to open a rebased version of this PR, in case @sgiacomel can't find the time to do it.

Hi, thank you for poking, I just rebased it. @miklos-martin

@codecov
Copy link

codecov bot commented Feb 8, 2021

Codecov Report

Merging #2950 (9cb517e) into master (d6592dd) will decrease coverage by 1.56%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #2950      +/-   ##
==========================================
- Coverage   61.77%   60.21%   -1.57%     
==========================================
  Files         142      142              
  Lines       23005    20443    -2562     
==========================================
- Hits        14211    12309    -1902     
+ Misses       7303     6661     -642     
+ Partials     1491     1473      -18     

@miklos-martin
Copy link

Nice, thanks

@akerouanton
Copy link
Member

@sgiacomel Maybe it's worth adding a test case in TestIsTaskDirty and then ping maintainers to ask if they could review/merge this change 🤔

@akerouanton
Copy link
Member

@dperny @thaJeztah Could you take a look? 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants