Details
Description
The class org.apache.felix.shell.impl.Activator$ShellServiceImpl makes heavy use of synchronized methods which synchronized on the ShellServiceImpl itself. This causes a deadlock if a refresh/resolve (PackageAdmin) cycle is initiated using the shell and some Commands are about to be removed from the OSGi service registry (as a result of the refresh/resolve).
This happens because executeCommand locks the ShellServiceImpl instance and later on when the PackageAdmin indirectly triggers the removal of some registered Commands ShellServiceImpl.removeCommand(...) will try to lock the same ShellServiceImpl instance which is still locked by the executeCommand.
I have created a patch for org.apache.felix.shell.impl.Activator (see Attachment) for a possible solution of this problem.