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

LocalTaskLauncher remove the instance from running map when task exits #76

Open
udaraliyanage opened this issue Oct 4, 2017 · 1 comment

Comments

@udaraliyanage
Copy link

udaraliyanage commented Oct 4, 2017

LocalTaskLauncher does not remove intances from running map Map<String, TaskInstance> running = new ConcurrentHashMap<>(); Thus tasks created are added to the map, but not removed even cancelled. However LocalAppDeployer remove from map in cancel().

@Override
	public void cancel(String id) {
		TaskInstance instance = running.get(id);
		if (instance != null) {
			instance.cancelled = true;
			if (isAlive(instance.getProcess())) {
				shutdownAndWait(instance);
			}
		}
	}

If you add running.remove(id) after shutdownAndwait it makes testSimpleCancel test case to be failed since getStatus return status as unknown when instance object is null.

assertThat(launchId, eventually(hasStatusThat(
				Matchers.<TaskStatus>hasProperty("state", Matchers.is(LaunchState.running))), timeout.maxAttempts, timeout.pause));
@Override
	public void cancel(String id) {
		TaskInstance instance = running.get(id);
		if (instance != null) {
			instance.cancelled = true;
			if (isAlive(instance.getProcess())) {           
				shutdownAndWait(instance);
			}
                        running.remove(id);
		}
	}
@markpollack
Copy link
Contributor

Indeed this does sound like this is an issue to fix.

@markpollack markpollack changed the title Should n't LocalTaskLauncher remove the instance from running map LocalTaskLauncher remove the instance from running map when task exits Mar 20, 2018
@markpollack markpollack added this to the 1.3.9.RELEASE milestone Sep 11, 2018
@sabbyanandan sabbyanandan modified the milestones: 1.3.10.RELEASE, 1.3.11.RELEASE Nov 15, 2018
@jvalkeal jvalkeal removed this from the 1.3.11.RELEASE milestone May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants