SEC-1104: Server created by ApacheDSContainer is shutdown twice, causing a hang #1354

Closed
spring-issuemaster opened this Issue Feb 9, 2009 · 3 comments

1 participant

@spring-issuemaster

Brian Topping (Migrated from SEC-1104) said:

I have a default ApacheDS server launched for testing via element in my spring config. This is inside a webapp, and the context is loaded through a servlet context listener (if that makes any difference).

ApacheDSContainer implements both Lifecycle and DisposableBean. Both destroy methods get called, but neither checks the ‘running’ field before trying to shut down the ApacheDS server. The first shutdown works, but since the server is contacted over a socket, the second attempt hangs until the socket times out.

The easy fix is to just check the ‘running’ field in the stop() method and don’t do anything if the server isn’t running.

@spring-issuemaster

Brian Topping said:

On further inspection, this problem was coincidental to starting to use the ApacheDSContainer, not causal. I believe there is a problem calling the stop method twice, although after cleaning up the code, my issue remains. So this could be set to a low priority or closed, although I will attach the patch here regardless.

@spring-issuemaster

Brian Topping said:

Patch for ApacheDSContainer.java to clean up lifecycle semantics

@spring-issuemaster

Luke Taylor said:

Thanks for the report. I've added a check of the "running" flag in the stop() method but I've retained the Lifecycle interface (unlike your patch). The same bean instance could potentially be started and stopped without necessarily being destroyed.

@spring-issuemaster spring-issuemaster added this to the 3.0.0 M1 milestone Feb 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment