title: Liferay module (OSGi bundle) stays in "Stopping"
body: <p>Sometimes when I stop my Liferay module (for instance when I put a new version of its JAR in <code>deploy/</code>) the module refuses to stop.</p>
  
  <p>While the module should go to "Resolved" state, it stays in the "Stopping" state forever:</p>
  
  <p><a href="https://i.stack.imgur.com/1IEPkm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1IEPkm.png" alt="OSGi lifecycle"></a></p>
  
  <p>Usually it is due to a thread not terminated somewhere, or a network connection not properly closed, and it is often a pain to investigate.</p>
  
  <p><strong>My question</strong>: How to find out more efficiently what this Liferay module's problem is?</p>
  
  <p>What I tried:</p>
  
  <ul>
  <li>In Gogo Shell <code>diag &lt;module id&gt;</code> does not seem to provide any valuable information about why the module refuses to leave the "Stopping" state.</li>
  <li><a href="https://docs.oracle.com/javase/8/docs/technotes/tools/unix/jstack.html" rel="nofollow noreferrer">jstack</a> outputs thousands of lines, the vast majority of which is outside of the Liferay module in question. If there was a way to show jstack information for only my module that would be wonderful.</li>
  </ul>