Standalone hangs when custom server code is deployed

Our standalone installation hangs new minutes after deploying java code.

Java code consits of Timer and Data handler.

I followed every documentation to implement it, I watched all videos and I installed the standalone using guides. I dont feel buying paid support is what you should be asking me to do.

These errors repeat in logs:



08:31:26.130 [DEBUG] DbConnectionMonitoring - Connection 'baff6993-f560-41fe-aba6-6c6ddc090c8f' was not released in time, for DB: null
        java.lang.Thread.getStackTrace(Thread.java:1552)
        com.backendless.db.connection.MonitoredConnection.<init>(MonitoredConnection.java:36)
        com.backendless.db.connection.factory.MonitoringConnectionFactory.getConnection(MonitoringConnectionFactory.java:26)
        com.backendless.db.connection.pool.DbCpConnectionPool.getConnection(DbCpConnectionPool.java:35)
        com.backendless.util.db.DbcpConnectionProviderImpl.getConnection(DbcpConnectionProviderImpl.java:55)
        com.backendless.util.db.MultiTenantConnectionProviderImpl.getAnyConnection(MultiTenantConnectionProviderImpl.java:27)
        com.backendless.util.db.MultiTenantConnectionProviderImpl.getConnection(MultiTenantConnectionProviderImpl.java:41)
        org.hibernate.internal.AbstractSessionImpl$ContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:429)
        org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:84)
        org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:109)
        org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:47)
        org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
        org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
        org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)
        org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1927)
        org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1896)
        org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1874)
        org.hibernate.loader.Loader.doQuery(Loader.java:919)
        org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
        org.hibernate.loader.Loader.doList(Loader.java:2610)
        org.hibernate.loader.Loader.doList(Loader.java:2593)
        org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2422)
        org.hibernate.loader.Loader.list(Loader.java:2417)
        org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
        org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
        org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
        org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339)
        org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
        org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
        org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:529)
        com.backendless.datamodel.application.dao.AppVersionDao.findBy(AppVersionDao.java:26)
        com.backendless.servercode.codeModel.ModelCodeExtender.getAppVersion(ModelCodeExtender.java:131)

        com.backendless.servercode.codeModel.ModelCodeExtender.getContext(ModelCodeExtender.java:82)
        com.backendless.services.persistence.common.CustomLogicDecorator.find(CustomLogicDecorator.java:164)
        com.backendless.services.persistence.common.CustomLogicDecorator.find(CustomLogicDecorator.java:29)
        com.backendless.services.persistence.common.PersistenceInterfaceAdapter.find(PersistenceInterfaceAdapter.java:102)
        com.backendless.logging.LogService.getLoggers(LogService.java:403)
        com.backendless.logging.LogService.getLogConfig(LogService.java:95)
        com.backendless.logging.LogService.access$000(LogService.java:43)
        com.backendless.logging.LogService$3$1.apply(LogService.java:327)
        com.backendless.logging.LogService$3$1.apply(LogService.java:323)
        com.backendless.util.SyncUtil.execute(SyncUtil.java:93)
        com.backendless.util.SyncUtil.execute(SyncUtil.java:60)
        com.backendless.logging.LogService$3.run(LogService.java:322)
        java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        java.lang.Thread.run(Thread.java:745)
08:33:27.128 [ERROR] backendless - main_application --- Lock was not released after 120 seconds, lock key is bckls_sync_key_59C562F3-C052-DCE2-FF20-41CBA2F5E300v1LogConfig59C562F3-C052-DCE2-FF20-41CBA2F5E300, applicationId is 59C562F3-C052-DCE2-FF20-41CBA2F5E300
08:33:27.133 [ERROR] backendless - 59C562F3-C052-DCE2-FF20-41CBA2F5E300 --- java.lang.InterruptedException
java.lang.RuntimeException: java.lang.InterruptedException
        at com.backendless.db.connection.ApplicationConnection.create(ApplicationConnection.java:22)
        at com.backendless.db.connection.pool.ApplicationPool.get(ApplicationPool.java:21)
        at com.backendless.db.connection.pool.WrappedConnectionPool.getConnection(WrappedConnectionPool.java:23)
        at com.backendless.db.connection.factory.MonitoringConnectionFactory.getConnection(MonitoringConnectionFactory.java:25)
        at com.backendless.db.connection.pool.DbCpConnectionPool.getConnection(DbCpConnectionPool.java:35)
        at com.backendless.util.db.DbcpConnectionProviderImpl.getConnection(DbcpConnectionProviderImpl.java:55)
        at com.backendless.util.db.MultiTenantConnectionProviderImpl.getAnyConnection(MultiTenantConnectionProviderImpl.java:27)
        at com.backendless.util.db.MultiTenantConnectionProviderImpl.getConnection(MultiTenantConnectionProviderImpl.java:41)
        at org.hibernate.internal.AbstractSessionImpl$ContextualJdbcConnectionAccess.obtainConnection(AbstractSessionImpl.java:429)
        at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.acquireConnectionIfNeeded(LogicalConnectionManagedImpl.java:84)
        at org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl.getPhysicalConnection(LogicalConnectionManagedImpl.java:109)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.connection(StatementPreparerImpl.java:47)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:146)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:172)
        at org.hibernate.engine.jdbc.internal.StatementPreparerImpl.prepareQueryStatement(StatementPreparerImpl.java:148)
        at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1927)
        at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1896)
        at org.hibernate.loader.Loader.executeQueryStatement(Loader.java:1874)
        at org.hibernate.loader.Loader.doQuery(Loader.java:919)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:336)
        at org.hibernate.loader.Loader.doList(Loader.java:2610)
        at org.hibernate.loader.Loader.doList(Loader.java:2593)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2422)
        at org.hibernate.loader.Loader.list(Loader.java:2417)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:501)
        at org.hibernate.hql.internal.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:371)
        at org.hibernate.engine.query.spi.HQLQueryPlan.performList(HQLQueryPlan.java:216)
        at org.hibernate.internal.SessionImpl.list(SessionImpl.java:1339)
        at org.hibernate.internal.QueryImpl.list(QueryImpl.java:87)
        at org.hibernate.jpa.internal.QueryImpl.list(QueryImpl.java:606)
        at org.hibernate.jpa.internal.QueryImpl.getSingleResult(QueryImpl.java:529)
        at com.backendless.datamodel.application.dao.AppVersionDao.findBy(AppVersionDao.java:26)
        at com.backendless.servercode.codeModel.ModelCodeExtender.getAppVersion(ModelCodeExtender.java:131)
        at com.backendless.servercode.codeModel.ModelCodeExtender.getContext(ModelCodeExtender.java:82)
        at com.backendless.services.persistence.common.CustomLogicDecorator.find(CustomLogicDecorator.java:164)
        at com.backendless.services.persistence.common.CustomLogicDecorator.find(CustomLogicDecorator.java:29)
        at com.backendless.services.persistence.common.PersistenceInterfaceAdapter.find(PersistenceInterfaceAdapter.java:102)
        at com.backendless.logging.LogService.getLoggers(LogService.java:403)
        at com.backendless.logging.LogService.getLogConfig(LogService.java:95)
        at com.backendless.logging.LogService.access$000(LogService.java:43)
        at com.backendless.logging.LogService$3$1.apply(LogService.java:327)
        at com.backendless.logging.LogService$3$1.apply(LogService.java:323)
        at com.backendless.util.SyncUtil.execute(SyncUtil.java:93)
        at com.backendless.util.SyncUtil.execute(SyncUtil.java:60)
        at com.backendless.logging.LogService$3.run(LogService.java:322)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

Caused by: java.lang.InterruptedException: null
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:998)
        at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
        at java.util.concurrent.Semaphore.acquire(Semaphore.java:312)
        at com.backendless.db.connection.ApplicationConnection.create(ApplicationConnection.java:18)
        ... 47 common frames omitted

Does the same BL code work on ONLINE service?

Yes it does. It also works in debug mode.

It is very hard to say what is the problem. It may be because java code runner on server is turned off, or has wrong configuration. I would able to connect to your server through SSH, and figure out what is a problem, if you buy payment support. Please contact sales@backendless.com to get more details.