chunhualiao / freeCompilerCamp

Goal: a website to automatically train and certify compiler researchers and developers
10 stars 1 forks source link

sandbox reset with empty container and root account #102

Open chunhualiao opened 4 years ago

chunhualiao commented 4 years ago

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 commented 4 years ago

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

ouankou commented 4 years ago

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 commented 4 years ago

I like your suggestions. Please go ahead when you have time.

Thank you.

On Mon, Apr 13, 2020, 12:43 PM Anjia Wang notifications@github.com wrote:

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.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/chunhualiao/freeCompilerCamp/issues/102#issuecomment-613061966, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMNIRTILQ5NIJTC7QC2DKLRMNTMRANCNFSM4LTZQHPA .