Atlas-clean doesn't work

Hello,

During development, every time I shut down my Bitbucket plugin using Ctrl-C the following happens:

[INFO] bitbucket: Shutting down
[INFO] Running Shutdown Hook
[WARNING] There was an error attempting to stop Bitbucket Server
[INFO] bitbucket: Shutting down
java.io.IOException: Failed to retrieve RMIServer stub: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
        java.net.SocketException: Connection reset by peer: socket write error]
    at javax.management.remote.rmi.RMIConnector.connect (RMIConnector.java:369)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:270)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:229)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.createConnector (BitbucketProductHandler.java:360)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.stop (BitbucketProductHandler.java:203)
    at com.atlassian.maven.plugins.amps.AbstractProductHandlerMojo.lambda$stopProducts$0 (AbstractProductHandlerMojo.java:908)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
Caused by: javax.naming.CommunicationException
    at com.sun.jndi.rmi.registry.RegistryContext.lookup (RegistryContext.java:136)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup (GenericURLContext.java:205)
    at javax.naming.InitialContext.lookup (InitialContext.java:417)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI (RMIConnector.java:1955)
    at javax.management.remote.rmi.RMIConnector.findRMIServer (RMIConnector.java:1922)
    at javax.management.remote.rmi.RMIConnector.connect (RMIConnector.java:287)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:270)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:229)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.createConnector (BitbucketProductHandler.java:360)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.stop (BitbucketProductHandler.java:203)
    at com.atlassian.maven.plugins.amps.AbstractProductHandlerMojo.lambda$stopProducts$0 (AbstractProductHandlerMojo.java:908)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
Caused by: java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is:
        java.net.SocketException: Connection reset by peer: socket write error
    at sun.rmi.transport.tcp.TCPChannel.createConnection (TCPChannel.java:307)
    at sun.rmi.transport.tcp.TCPChannel.newConnection (TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.newCall (UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.lookup (RegistryImpl_Stub.java:116)
    at com.sun.jndi.rmi.registry.RegistryContext.lookup (RegistryContext.java:132)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup (GenericURLContext.java:205)
    at javax.naming.InitialContext.lookup (InitialContext.java:417)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI (RMIConnector.java:1955)
    at javax.management.remote.rmi.RMIConnector.findRMIServer (RMIConnector.java:1922)
    at javax.management.remote.rmi.RMIConnector.connect (RMIConnector.java:287)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:270)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:229)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.createConnector (BitbucketProductHandler.java:360)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.stop (BitbucketProductHandler.java:203)
    at com.atlassian.maven.plugins.amps.AbstractProductHandlerMojo.lambda$stopProducts$0 (AbstractProductHandlerMojo.java:908)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
Caused by: java.net.SocketException: Connection reset by peer: socket write error
    at java.net.SocketOutputStream.socketWrite0 (Native Method)
    at java.net.SocketOutputStream.socketWrite (SocketOutputStream.java:111)
    at java.net.SocketOutputStream.write (SocketOutputStream.java:155)
    at java.io.BufferedOutputStream.flushBuffer (BufferedOutputStream.java:82)
    at java.io.BufferedOutputStream.flush (BufferedOutputStream.java:140)
    at java.io.DataOutputStream.flush (DataOutputStream.java:123)
    at sun.rmi.transport.tcp.TCPChannel.createConnection (TCPChannel.java:229)
    at sun.rmi.transport.tcp.TCPChannel.newConnection (TCPChannel.java:202)
    at sun.rmi.server.UnicastRef.newCall (UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.lookup (RegistryImpl_Stub.java:116)
    at com.sun.jndi.rmi.registry.RegistryContext.lookup (RegistryContext.java:132)
    at com.sun.jndi.toolkit.url.GenericURLContext.lookup (GenericURLContext.java:205)
    at javax.naming.InitialContext.lookup (InitialContext.java:417)
    at javax.management.remote.rmi.RMIConnector.findRMIServerJNDI (RMIConnector.java:1955)
    at javax.management.remote.rmi.RMIConnector.findRMIServer (RMIConnector.java:1922)
    at javax.management.remote.rmi.RMIConnector.connect (RMIConnector.java:287)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:270)
    at javax.management.remote.JMXConnectorFactory.connect (JMXConnectorFactory.java:229)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.createConnector (BitbucketProductHandler.java:360)
    at com.atlassian.maven.plugins.amps.product.BitbucketProductHandler.stop (BitbucketProductHandler.java:203)
    at com.atlassian.maven.plugins.amps.AbstractProductHandlerMojo.lambda$stopProducts$0 (AbstractProductHandlerMojo.java:908)
    at java.util.concurrent.Executors$RunnableAdapter.call (Executors.java:511)
    at java.util.concurrent.FutureTask.run (FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:624)
    at java.lang.Thread.run (Thread.java:748)
[INFO] amps:stop in 0s
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:44 min
[INFO] Finished at: 2021-02-24T11:53:57+01:00
[INFO] ------------------------------------------------------------------------

Subsequently I cannot perform an

atlas-clean

the following is displayed:

[INFO] Project POM found
Executing: "C:\Applications\Atlassian\atlassian-plugin-sdk-8.2.6\apache-maven-3.5.4\bin\mvn.cmd" clean -gs C:\Applications\Atlassian\atlassian-plugin-sdk-8.2.6\apache-maven-3.5.4/conf/settings.xml
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< com.myscanner:plugin >------------------
[INFO] Building MyScanner Plugin 1.0-SNAPSHOT
[INFO] --------------------------[ atlassian-plugin ]--------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ plugin ---
[INFO] Deleting C:\Dev\myscanner\plugin\target
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.801 s
[INFO] Finished at: 2021-02-24T12:22:47+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project plugin: Failed to clean project: Failed to delete C:\Dev\myscanner\plugin\target\bitbucket\home\search\modules\transport-netty4\transport-netty4-5.5.3.jar -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

The only way I have found to unlock the file is to reboot the machine which is far from ideal!

Any ideas?

Cheers!

Ctrl+D is probably better to shut down with. Ctrl+C is a hard terminate. You probably have files still running when you try to run atlas-clean, so it’s probably windows screaming " FILE HANDLES iN USE ".

Yeah, I tried various tools to remove the file handles in use but to no avail. Regrettably, Ctrl+D doesn’t work. I’m on Windows 10 and so far only Ctrl-C gets it done. Is there a server shutdown function within the BitBucket UI maybe?
Cheers

If nothing described above helps, please log a bug in the ATLASSDK project.

Oh, and please also try mvn clean to see if that works any better or differently to atlas-clean.

Yeah sorry, it seems like it’s a pain to send ^D (EOF) on windows. For me on OSX that is a graceful shutdown.

When searching this forum, I found a similar post. Perhaps this is helpful? Can't start/stop Bitbucket Server - #2 by anon79310877

PJam
Problem
When I use shortcut to stop Bitbucket, the terminal display a lot of lines about exceptions. Process is not terminated, because in Task Manager I found OpenJDK with allocated ~2GB of RAM.

Solution
First:
atlas-mvn bitbucket:stop

Second:
CTRL+C

Ctrl-Z then return does the trick! I have the Windows 10 “legacy console” option ticked (although I’m not entirely sure that it’s necessary).
Thanks for all the suggestions!

1 Like