Skip to content
This repository has been archived by the owner on May 6, 2020. It is now read-only.

ioSession: Simplify token management #108

Closed

Conversation

jcvenegas
Copy link
Contributor

proxy: unregisterVM free token
proxy: Remove tokenToSession map from proxy.
client: Remove token from client struct
token: remove tokeninfo struct

Fixes: #66

tokeninfo struct is used to manage tokenStateAllocated state.
We can remove move that field to ioSession and remove this structure.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
Token can be accessed by client.session.token

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
tokenToSession map is used to easily find a session associated
with a token.

The a session reference was keep in muitples places:

- proxy.tokenToSession[token]
- proxy.vms[container-id].tokenToSession[token]
- proxy.vms[container-id].ioSessions[sequence-number]

Removing tokenToSession the references are keep only in vm struct.

Also, disconnectShim was removing sessions from vm struct but not from
this map leading to never free tokens added to tokenToSession.

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
When unregisterVM is called we want to free all the tokens we register
previously, all the tokens should not be valid anymore.

Fixes: clearcontainers#66

Signed-off-by: Jose Carlos Venegas Munoz <jose.carlos.venegas.munoz@intel.com>
@jcvenegas jcvenegas force-pushed the simplify-token-management branch from 6f65d45 to f661105 Compare August 21, 2017 20:42
@jcvenegas jcvenegas requested a review from devimc August 21, 2017 20:43
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.4%) to 73.859% when pulling f661105 on jcvenegas:simplify-token-management into d7a4dd8 on clearcontainers:master.

1 similar comment
@coveralls
Copy link

coveralls commented Aug 21, 2017

Coverage Status

Coverage decreased (-0.4%) to 73.859% when pulling f661105 on jcvenegas:simplify-token-management into d7a4dd8 on clearcontainers:master.

@sboeuf
Copy link
Contributor

sboeuf commented Aug 22, 2017

I really need to spend some time on this. Please don't merge before I review it.

@clearcontainersbot
Copy link

Popular Images qa-passed 👍

@sboeuf
Copy link
Contributor

sboeuf commented Aug 25, 2017

@jcvenegas what is the status of this PR, still WIP ?
Also, is that a release-gating issue ? I want to know in order to understand if we want to spend some time on this for the next week(s).

@clearcontainersbot
Copy link

Popular Images qa-passed 👍

@jcvenegas
Copy link
Contributor Author

@sboeuf I remember I've seen some failing tests in semaphore related with cri-o. But last semaphore build passed. That is why I marked as WIP. It is ready for review.

The issues is marked as beta gating and the proxy is 'leaking'/not garbage collecting iosessions after the VM finish.

@sboeuf
Copy link
Contributor

sboeuf commented Aug 28, 2017

Ok I'll review it

proxy.go Outdated
@@ -70,8 +56,8 @@ type proxy struct {
// vms are hashed by their containerID
vms map[string]*vm

// tokenToVM maps I/O token to their per-token info
tokenToVM map[Token]*tokenInfo
// tokenToSession maps I/O token to their per-token info
Copy link
Contributor

Choose a reason for hiding this comment

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

The comment is now incorrect.

@@ -103,6 +103,8 @@ type ioSession struct {
// started. This is used to stop the shim from sending stdin data to a
// non-existent process.
processStarted chan interface{}

state tokenState
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to put a comment on this, for consistency with the other fields.

@@ -158,34 +140,38 @@ func (proxy *proxy) allocateTokens(vm *vm, numIOStreams int) (*api.IOResponse, e
}, nil
}

func (proxy *proxy) claimToken(token Token) (*tokenInfo, error) {
func (proxy *proxy) claimToken(token Token) (*ioSession, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Although it might not strictly be part of this PR, should this function check for token == nilToken as releaseToken() does?

@jcvenegas jcvenegas force-pushed the simplify-token-management branch from c96be34 to f661105 Compare August 31, 2017 18:11
@clearcontainersbot
Copy link

Popular Images qa-passed 👍

@sboeuf
Copy link
Contributor

sboeuf commented Sep 1, 2017

@jcvenegas Okay I am trying to review this PR but I would really appreciate more comments and bigger commit messages to explain the reason why we can do those simplifications. I am not saying this PR is wrong but I want to make sure we're not missing something here. If we can simplify those structures, we should be able to explain it properly.

@sboeuf
Copy link
Contributor

sboeuf commented Sep 1, 2017

And apparently something is wrong because Semaphore and Jenkins are consistently failing on the same CRI-O test (15).

@amshinde
Copy link
Contributor

@jcvenegas What is the status on this PR? Can you address @sboeuf's comment for adding verbose commit messages explaining the reasoning for the simplifications. It will help review the PR.

@clearcontainersbot
Copy link

kubernetes qa-passed 👍

@sboeuf
Copy link
Contributor

sboeuf commented Oct 12, 2017

@jcvenegas any update/progress on this one ?

@clearcontainersbot
Copy link

kubernetes qa-failed 👎

@sboeuf
Copy link
Contributor

sboeuf commented Nov 13, 2017

@jcvenegas I think we should close this PR. What do you think ?

@jcvenegas
Copy link
Contributor Author

jcvenegas commented Nov 14, 2017

@sboeuf yes, closing PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants