eclipse-che / che

Kubernetes based Cloud Development Environments for Enterprise Teams
http://eclipse.org/che
Eclipse Public License 2.0
6.99k stars 1.19k forks source link

Sometimes, commands are not added correctly on workspace creation from stack #2680

Closed AndreyChizhikov closed 8 years ago

AndreyChizhikov commented 8 years ago

Reproduction Steps:

  1. Create workspace from 'Bitnami Codeigniter' stack with 'codeigniter' project
  2. Go to 'Run' -> 'Edit Commands...'

Expected behavior: "codeigniter: 1. Create and run project" and "codeigniter: 2. Run" are presented in the 'command' widget Observed behavior: Sometimes, only the "codeigniter: 1. Create and run project" command is presented in the 'commands' widget commands

Che version: 5.0.0-M5-SNAPSHOT OS and version: Ubuntu 14.04 LTS Docker version: 1.11.2 Che install: Docker container

Additional information:

kaloyan-raev commented 8 years ago

This also happened to me several times with the 'Bitnami Laravel' stack. Command No.1 is missing, the rest are available.

No reliable way to reproduce it.

ashumilova commented 8 years ago

Will try to fix it ASAP.

olexii4 commented 8 years ago

Cannot reproduce

kaloyan-raev commented 8 years ago

This issue still happens to me very often with variety of stacks and project templates.

I debugged the problem and found the root cause.

The Dashboard's Create Project Controller sends addCommand and updateProject requests in parallel. This results in calling the respective addCommand and updateProject methods in the WorkspaceService, which both try to update the workspace's config object in a race condition.

There are two ways to fix this issue:

  1. (Easier) Avoid calling addCommand and updateProject in parallel. Instead, call them updateProject after receiving the response from all addCommand requests.
  2. (Better) Implement appropriate synchronization in the WorkspaceService.

Please reopen the issue.

ashumilova commented 8 years ago

@olexii4 : Try to use update workspace service for adding bunch of commands at once instead of adding it one by one. @kaloyan-raev : thank you for pointing it out.

kaloyan-raev commented 8 years ago

I created PR #2928 that fixes the issue.