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

sandbox reset with empty container and root account #102

Open
chunhualiao opened this issue Mar 25, 2020 · 3 comments
Open

sandbox reset with empty container and root account #102

chunhualiao opened this issue Mar 25, 2020 · 3 comments

Comments

@chunhualiao
Copy link
Owner

Solution by Anjia:

I checked the configuration file of freeCC. It's correctly set to use freecompilercamp/pwc.

https://github.com/freeCompilerCamp/play-with-compiler/blob/master/api.go#L55

I think we can restart the server and it should work again.

@chunhualiao
Copy link
Owner Author

restarting fixed it. Don't know why it happened.

@ouankou
Copy link
Collaborator

ouankou commented Apr 13, 2020

I went through the code and confirmed the process from beginning to create a new sandbox. The final step that actually creates the new container is the following lines.
https://github.com/freeCompilerCamp/play-with-compiler/blob/e0ce49d9b3930d16c6625612a9dabddb33fa2e12/provisioner/dind.go#L44-L51

If there's no docker image specified in the tutorial, an empty string for docker image will be passed to PWC and carried to this function. Then it will use the default image, which is set to freecompilercamp/pwc:1.0, to replace this empty string.

However, this bug indicated that the default image was changed to franela/dind due to unknown reasons. I didn't find any code that overwrites this default image or anywhere specifically mentioned franela/dind except in api.go.

After the bug happened:

  1. I can manually create new containers based on freecompilercamp/pwc:1.0 on the AWS, which proves the docker image is fine.
  2. I also modified a tutorial to set up the required docker image explicitly, such as freecompilercamp/pwc:1.0 and freecompilercamp/pwc:18.04. In this case, the correct sandbox showed up instead of the empty one franela/dind.
  3. There are no failed HTTP requests between classroom and PWC even the sandbox is not correct.

In api.go, we currently put franela/dind in the second position in the available images. freecompilercamp/pwc:1.0 is the first one and set to be the default one.

A long time ago, I remembered that while we only use freecompilercamp/pwc:1.0 for PWC without any other available docker image, it happened that the sandbox cannot pop out. Maybe it was caused by the same reason. PWC can't connect with the default image and has to reach the next alternative. Since there was no other option at that moment, the system got stuck and no sandbox can be created.

I suggest:

  1. We could remove frenela/dind and put another image we built in the second position to see if PWC skipped the first one due to any bug. If in the future, the same issue happens again, I would consider this as an upstream bug from Play-With-Docker and report it back to address together.
  2. In the meantime, we add the required image name to each tutorial, at least to the new ones.

@chunhualiao
Copy link
Owner Author

chunhualiao commented Apr 13, 2020 via email

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

No branches or pull requests

2 participants