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

Running exec during container create results in a ConcurrentAccess error #4881

Closed
jakedsouza opened this issue Apr 25, 2017 · 1 comment
Closed
Milestone

Comments

@jakedsouza
Copy link
Contributor

VIC version:
vic-machine-linux version v0.8.0-0-91097e2 on master

Deployment details:
Single VCH deployed on a cluster

What was the vic-machine create command used to deploy the VCH?

./bin-master/vic-machine-linux create -t 10.192.250.50 -u="administrator@vsphere.local" -p="pass" --image-store="datastore11/${vchName}-imagestore" --volume-store="datastore11/${vchName}-volumestore:volumestore" --volume-store="datastore11/${vchName}-volumestore:default"  --tls-cname="*.eng.vmware.com"  --timeout 6m --name ${vchName} --thumbprint=08:87:A6:D6:B8:99:70:51:F5:1F:42:1B:52:C2:59:97:8A:2A:0C:34 --compute-resource=cls --bridge-network=bridge --insecure-registry=10.192.236.96 --debug=2 --no-tls

Steps to reproduce:

  1. Deploy VCH
  2. In terminal 1 run exec command repeatedly
watch  -n 1 docker exec -d c1  ls /
  1. In terminal 2 start and run a container
docker run -it --name c1 -v test17:/etc/example alpine /bin/ash

Actual behavior:

  1. We do see a valid error Error response from daemon: No such container while the container vm is being created
  2. After this, we see another error
Server error from portlayer: [PUT /containers    /{handle}][409] commitConflict  &{Code:0 Message:Cannot complete operation due to concurrent modification by another operation.}

Expected behavior:

  1. Expect to see an error Error response from daemon: No such container while the container vm is being created
  2. See no error once the container is created

NOTE

  1. While we do see an error, it is tricky to reproduce consistently as it seems to occur during tether startup.
  2. Also AFAIK the error does not seem to affect the container creation. All functionality seems to work fine.

Logs:

Attached logs. The container is named large in the logs

container-logs.zip

@caglar10ur
Copy link
Contributor

Added retry support to exec branch (#4339) to handle this (regular attach path already does that)

caglar10ur added a commit that referenced this issue Apr 27, 2017
* Attach support for exec'ed session

Includes @hmahmood's and @hickeng's various fixed to dio/persona and portlayer

Fixes #4263
Fixes #4367
Fixes #4598
Fixes #4410
Fixes #4339
Fixes #4881

Requires #4288

Implements exec functionality for personality
Those changes live in lib/apiservers/engine/backends/ directory. There are changes in container_proxy functions since exec and attach shares some common code paths. We started to pass ids instead of viccontainer structs around to them to support both workflows. AttachStreams function splits the cancelation logic into different parts. Closing stdin cancels other active streams. We also ensure that the API client connection is shutdown on exit.

Implements exec support for portlayer rest api
Those changes live in lib/apiservers/portlayer/ directory. One important change there is context changes. In the past we were calculating the timeouts manually and then passing timeouts as a parameter to Get call.
session, err := attachServer.Get(context.Background(), params.ID, timeout)

now each stream is creating its own context and passing it to the function - eliminating manual calculations and redundant timeout value.

session, err := i.server.Interaction(ctx, params.ID)

Portlayer attach subsystem re-organization
Those changes live in lib/portlayer/attach/. Some of them just renames and splitting monolithic file (they are now bind.go/join.go etc.) into pieces. Connector has new set of features. We now have a different unblock signal for signaling tether (called unblock) for starting the processes inside the container. We also now have a SSH channel mux running on client side to receive container ids from tether. Normally portlayer initiates the connection and asks container ids. This is still the case for the primary session. But after that primary session start event, any exec'ed session will cause tether to restart and as a part of that tether will push container ids to the portlayer. Additionally we now started to use channel mux to evict closed connections from the connection map (#4367). Lastly we started to use singleflight to make sure that there is only one call in-flight for each ID at any given time.

tether support for exec
As noted above, tether now pushes container ids to portlayer when it receives reload signal. It supports new unblock signal. Fixes a bug caused by wrong usage of cleanup functions. Fixes races causing incorrect behaviors.

dio changes
dio reader now has a PropagateEOF function toggles whether to return EOF when all readers return EOF. Setting this to true will result in an EOF if there are no readers available when Read is next called. dio writer now calls CloseWrite if the writes implements CloseWriter.
@mdubya66 mdubya66 added this to the Sprint 8 milestone May 1, 2017
matthewavery pushed a commit to matthewavery/vic that referenced this issue May 3, 2017
* Attach support for exec'ed session

Includes @hmahmood's and @hickeng's various fixed to dio/persona and portlayer

Fixes vmware#4263
Fixes vmware#4367
Fixes vmware#4598
Fixes vmware#4410
Fixes vmware#4339
Fixes vmware#4881

Requires vmware#4288

Implements exec functionality for personality
Those changes live in lib/apiservers/engine/backends/ directory. There are changes in container_proxy functions since exec and attach shares some common code paths. We started to pass ids instead of viccontainer structs around to them to support both workflows. AttachStreams function splits the cancelation logic into different parts. Closing stdin cancels other active streams. We also ensure that the API client connection is shutdown on exit.

Implements exec support for portlayer rest api
Those changes live in lib/apiservers/portlayer/ directory. One important change there is context changes. In the past we were calculating the timeouts manually and then passing timeouts as a parameter to Get call.
session, err := attachServer.Get(context.Background(), params.ID, timeout)

now each stream is creating its own context and passing it to the function - eliminating manual calculations and redundant timeout value.

session, err := i.server.Interaction(ctx, params.ID)

Portlayer attach subsystem re-organization
Those changes live in lib/portlayer/attach/. Some of them just renames and splitting monolithic file (they are now bind.go/join.go etc.) into pieces. Connector has new set of features. We now have a different unblock signal for signaling tether (called unblock) for starting the processes inside the container. We also now have a SSH channel mux running on client side to receive container ids from tether. Normally portlayer initiates the connection and asks container ids. This is still the case for the primary session. But after that primary session start event, any exec'ed session will cause tether to restart and as a part of that tether will push container ids to the portlayer. Additionally we now started to use channel mux to evict closed connections from the connection map (vmware#4367). Lastly we started to use singleflight to make sure that there is only one call in-flight for each ID at any given time.

tether support for exec
As noted above, tether now pushes container ids to portlayer when it receives reload signal. It supports new unblock signal. Fixes a bug caused by wrong usage of cleanup functions. Fixes races causing incorrect behaviors.

dio changes
dio reader now has a PropagateEOF function toggles whether to return EOF when all readers return EOF. Setting this to true will result in an EOF if there are no readers available when Read is next called. dio writer now calls CloseWrite if the writes implements CloseWriter.
fdawg4l pushed a commit to fdawg4l/vic that referenced this issue May 8, 2017
* Attach support for exec'ed session

Includes @hmahmood's and @hickeng's various fixed to dio/persona and portlayer

Fixes vmware#4263
Fixes vmware#4367
Fixes vmware#4598
Fixes vmware#4410
Fixes vmware#4339
Fixes vmware#4881

Requires vmware#4288

Implements exec functionality for personality
Those changes live in lib/apiservers/engine/backends/ directory. There are changes in container_proxy functions since exec and attach shares some common code paths. We started to pass ids instead of viccontainer structs around to them to support both workflows. AttachStreams function splits the cancelation logic into different parts. Closing stdin cancels other active streams. We also ensure that the API client connection is shutdown on exit.

Implements exec support for portlayer rest api
Those changes live in lib/apiservers/portlayer/ directory. One important change there is context changes. In the past we were calculating the timeouts manually and then passing timeouts as a parameter to Get call.
session, err := attachServer.Get(context.Background(), params.ID, timeout)

now each stream is creating its own context and passing it to the function - eliminating manual calculations and redundant timeout value.

session, err := i.server.Interaction(ctx, params.ID)

Portlayer attach subsystem re-organization
Those changes live in lib/portlayer/attach/. Some of them just renames and splitting monolithic file (they are now bind.go/join.go etc.) into pieces. Connector has new set of features. We now have a different unblock signal for signaling tether (called unblock) for starting the processes inside the container. We also now have a SSH channel mux running on client side to receive container ids from tether. Normally portlayer initiates the connection and asks container ids. This is still the case for the primary session. But after that primary session start event, any exec'ed session will cause tether to restart and as a part of that tether will push container ids to the portlayer. Additionally we now started to use channel mux to evict closed connections from the connection map (vmware#4367). Lastly we started to use singleflight to make sure that there is only one call in-flight for each ID at any given time.

tether support for exec
As noted above, tether now pushes container ids to portlayer when it receives reload signal. It supports new unblock signal. Fixes a bug caused by wrong usage of cleanup functions. Fixes races causing incorrect behaviors.

dio changes
dio reader now has a PropagateEOF function toggles whether to return EOF when all readers return EOF. Setting this to true will result in an EOF if there are no readers available when Read is next called. dio writer now calls CloseWrite if the writes implements CloseWriter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants