Skip to content

Fix memory leak in BasicCommandStore#27

Closed
3cky wants to merge 1 commit intoapache:masterfrom
3cky:fix-basic-command-store-memory-leak
Closed

Fix memory leak in BasicCommandStore#27
3cky wants to merge 1 commit intoapache:masterfrom
3cky:fix-basic-command-store-memory-leak

Conversation

@3cky
Copy link
Contributor

@3cky 3cky commented Jul 8, 2016

Currently scheduled commands are not removed from BasicCommandStore upon executing, so memory leak is introduced. This patch fixes memory leak and also simplifies command scheduling and timeout handling code.

@jbonofre
Copy link
Member

jbonofre commented Jul 8, 2016

R: @jbonofre

@jbonofre
Copy link
Member

Your PR breaks command support (a command never get the pending result from the store).

@jbonofre
Copy link
Member

I'm checking why.

@jbonofre
Copy link
Member

OK, the problem is related to:

commandStore.getPending().remove(id);

It removes the pending command (all commands) from any recipient without waiting the result leading to a timeout.

@jbonofre
Copy link
Member

I don't think it's actually a problem. Let me explain.

The ClusteredExecutionContext creates a thread to cleanup the command after timeout (consumed or not). It's where we have the timeoutScheduler (a ExecutorService). The ClusteredExecutionContext systematically creates a TimeoutTask for each Command that cleanup the pending map in the BasicCommandStore. So there is no memory leak IMHO.

@3cky
Copy link
Contributor Author

3cky commented Jul 10, 2016

Thanks for reviewing this PR, @jbonofre! In fact, we're using forked version of Cellar, so I done code bases comparison and I think this memory leak is already fixed in master by commit 71a5f9e. Still not clear to me why commandStore.getPending().remove(id) breaks command support, seem to work in our case. Nevertheless, this PR can be closed, I think.

@jbonofre
Copy link
Member

+1
Can you please close the PR ?

Thanks !

@3cky 3cky closed this Jul 10, 2016
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

Successfully merging this pull request may close these issues.

2 participants