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

CODENVY-1403: fix bug in machine removal #4154

Merged
merged 3 commits into from
Feb 16, 2017

Conversation

garagatyi
Copy link

What does this PR do?

Fix bug in machine removal.
Bug occurs when container is unavailable without stop of machine.
In that case we don't stop machine instance and not cleanup
resources.

What issues does this PR fix or reference?

Related to codenvy/codenvy#1403

Changelog

Fix machine stop in case docker container was stopped or killed not by Codenvy.

Release Notes

Docs PR

Bug occurs when container is unavailable without stop of machine.
In that case we don't stop machine instance and not cleanup
resources.
Signed-off-by: Alexander Garagatyi
@garagatyi garagatyi added the kind/bug Outline of a bug - must adhere to the bug report template. label Feb 16, 2017
.withError(message);

try {
if (!Strings.isNullOrEmpty(message)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

How it can became empty ??

Copy link
Author

Choose a reason for hiding this comment

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

😄 copied from older code. Good catch!

@@ -158,7 +160,12 @@ public CheEnvironmentEngine(SnapshotDao snapshotDao,
"/recipe/.*$)|(^/recipe/.*$)");
this.containerNameGenerator = containerNameGenerator;

eventService.subscribe(new MachineCleaner());
eventService.subscribe(event -> {
Copy link
Contributor

@voievodin voievodin Feb 16, 2017

Choose a reason for hiding this comment

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

Can you please subscribe outside the constructor e.g.

@PostConstruct
private void subscribe() {
    eventSubscriber.subscribe(...)
}

As you implicitly expose instance which hasn't been fully constructed yet

Copy link
Author

Choose a reason for hiding this comment

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

ok

"MB. Create a new machine configuration that allocates additional RAM or increase " +
"the workspace RAM limit in the user dashboard.";
}
MachineStatusEvent destroyedEvent = newDto(MachineStatusEvent.class)
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we move this event to the place where it's published

eventService.publish(newDto(...));

@codenvy-ci
Copy link

Alexander Garagatyi added 2 commits February 16, 2017 16:02
Signed-off-by: Alexander Garagatyi <agaragatyi@codenvy.com>
… Alexander Garagatyi <agaragatyi@codenvy.com>
@garagatyi
Copy link
Author

@mshaposhnik @evoevodin I updated PR

@garagatyi garagatyi merged commit e55dd12 into eclipse-che:master Feb 16, 2017
@garagatyi garagatyi deleted the CODENVY-1403 branch February 16, 2017 15:05
@codenvy-ci
Copy link

@JamesDrummond JamesDrummond added this to the 5.3.0 milestone Feb 17, 2017
@JamesDrummond JamesDrummond mentioned this pull request Feb 17, 2017
9 tasks
JPinkney pushed a commit to JPinkney/che that referenced this pull request Aug 17, 2017
Bug occurs when container is unavailable without stop of machine.
In that case we don't stop machine instance and not cleanup
resources.
Signed-off-by: Alexander Garagatyi
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Outline of a bug - must adhere to the bug report template.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants