Buggy code:
@ Override @ ActionEvent ( eventType = EventTypes . EVENT_ROUTER_REBOOT , eventDescription = "rebooting<seq2seq4repair_space>router<seq2seq4repair_space>Vm" , async = true ) public VirtualRouter rebootRouter ( final long routerId , final boolean reprogramNetwork ) throws ConcurrentOperationException , InsufficientCapacityException , ResourceUnavailableException { } static final ConfigKey < Boolean > UseExternalDnsServers = new ConfigKey < Boolean > ( Boolean . class , "use.external.dns" , "Advanced" , "false" , "Bypass<seq2seq4repair_space>internal<seq2seq4repair_space>dns,<seq2seq4repair_space>use<seq2seq4repair_space>external<seq2seq4repair_space>dns1<seq2seq4repair_space>and<seq2seq4repair_space>dns2" , true , Scope . Zone , null ) ; static final ConfigKey < Boolean > routerVersionCheckEnabled = new ConfigKey < Boolean > ( "Advanced" , Boolean . class , "router.version.check" , "true" , "If<seq2seq4repair_space>true,<seq2seq4repair_space>router<seq2seq4repair_space>minimum<seq2seq4repair_space>required<seq2seq4repair_space>version<seq2seq4repair_space>is<seq2seq4repair_space>checked<seq2seq4repair_space>before<seq2seq4repair_space>sending<seq2seq4repair_space>command" , false ) ; @ Override public boolean configure ( final String name , final Map < String , Object > params ) throws ConfigurationException { } @ Override public boolean start ( ) { } @ Override public boolean stop ( ) { } protected VirtualNetworkApplianceManagerImpl ( ) { } protected class NetworkUsageTask extends ManagedContextRunnable { public NetworkUsageTask ( ) { } @ Override protected void runInContext ( ) { } } protected class NetworkStatsUpdateTask extends ManagedContextRunnable { public NetworkStatsUpdateTask ( ) { } @ Override protected void runInContext ( ) { } } @ DB protected void updateSite2SiteVpnConnectionState ( final List < DomainRouterVO > routers ) { for ( final DomainRouterVO router : routers ) { final List < Site2SiteVpnConnectionVO > conns = _s2sVpnMgr . getConnectionsForRouter ( router ) ; if ( ( conns == null ) || ( conns . isEmpty ( ) ) ) { continue ; } if ( ( router . getState ( ) ) != ( State . Running ) ) { for ( final Site2SiteVpnConnectionVO conn : conns ) { if ( ( conn . getState ( ) ) != ( State . Error ) ) { conn . setState ( Disconnected ) ; _s2sVpnConnectionDao . persist ( conn ) ; } } continue ; } final List < String > ipList = new ArrayList < String > ( ) ; for ( final Site2SiteVpnConnectionVO conn : conns ) { if ( ( ( conn . getState ( ) ) != ( State . Connected ) ) && ( ( conn . getState ( ) ) != ( State . Disconnected ) ) ) { continue ; } final Site2SiteCustomerGateway gw = _s2sCustomerGatewayDao . findById ( conn . getCustomerGatewayId ( ) ) ; ipList . add ( gw . getGatewayIp ( ) ) ; } final String privateIP = router . getPrivateIpAddress ( ) ; final HostVO host = _hostDao . findById ( router . getHostId ( ) ) ; if ( ( host == null ) || ( ( host . getState ( ) ) != ( Status . Up ) ) ) { continue ; } else if ( ( host . getManagementServerId ( ) ) != ( ManagementServerNode . getManagementServerId ( ) ) ) { continue ; } else if ( privateIP != null ) { final CheckS2SVpnConnectionsCommand command = new CheckS2SVpnConnectionsCommand ( ipList ) ; command . setAccessDetail ( ROUTER_IP , getRouterControlIp ( router . getId ( ) ) ) ; command . setAccessDetail ( ROUTER_NAME , router . getInstanceName ( ) ) ; command . setWait ( 30 ) ; final Answer origAnswer = _agentMgr . easySend ( router . getHostId ( ) , command ) ; CheckS2SVpnConnectionsAnswer answer = null ; if ( origAnswer instanceof CheckS2SVpnConnectionsAnswer ) { answer = ( ( CheckS2SVpnConnectionsAnswer ) ( origAnswer ) ) ; } else { VirtualNetworkApplianceManagerImpl . s_logger . warn ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>update<seq2seq4repair_space>router<seq2seq4repair_space>" + ( router . getHostName ( ) ) ) + "'s<seq2seq4repair_space>VPN<seq2seq4repair_space>connection<seq2seq4repair_space>status" ) ) ; continue ; } if ( ! ( answer . getResult ( ) ) ) { VirtualNetworkApplianceManagerImpl . s_logger . warn ( ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>update<seq2seq4repair_space>router<seq2seq4repair_space>" + ( router . getHostName ( ) ) ) + "'s<seq2seq4repair_space>VPN<seq2seq4repair_space>connection<seq2seq4repair_space>status" ) ) ; continue ; } for ( final Site2SiteVpnConnectionVO conn : conns ) { final Site2SiteVpnConnectionVO lock = _s2sVpnConnectionDao . acquireInLockTable ( conn . getId ( ) ) ; if ( lock == null ) { <START_BUG> throw new com . cloud . utils . exception . CloudRuntimeException ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>acquire<seq2seq4repair_space>lock<seq2seq4repair_space>on<seq2seq4repair_space>" + lock ) ) ; <END_BUG> } try { if ( ( ( conn . getState ( ) ) != ( State . Connected ) ) && ( ( conn . getState ( ) ) != ( State . Disconnected ) ) ) { continue ; } final Site2SiteVpnConnection . State oldState = conn . getState ( ) ; final Site2SiteCustomerGateway gw = _s2sCustomerGatewayDao . findById ( conn . getCustomerGatewayId ( ) ) ; if ( answer . isConnected ( gw . getGatewayIp ( ) ) ) { conn . setState ( Connected ) ; } else { conn . setState ( Disconnected ) ; } _s2sVpnConnectionDao . persist ( conn ) ; if ( oldState != ( conn . getState ( ) ) ) { final String title = ( ( ( ( "Site-to-site<seq2seq4repair_space>Vpn<seq2seq4repair_space>Connection<seq2seq4repair_space>to<seq2seq4repair_space>" + ( gw . getName ( ) ) ) + "<seq2seq4repair_space>just<seq2seq4repair_space>switch<seq2seq4repair_space>from<seq2seq4repair_space>" ) + oldState ) + "<seq2seq4repair_space>to<seq2seq4repair_space>" ) + ( conn . getState ( ) ) ; final String context = ( ( ( ( ( ( ( ( ( "Site-to-site<seq2seq4repair_space>Vpn<seq2seq4repair_space>Connection<seq2seq4repair_space>to<seq2seq4repair_space>" + ( gw . getName ( ) ) ) + "<seq2seq4repair_space>on<seq2seq4repair_space>router<seq2seq4repair_space>" ) + ( router . getHostName ( ) ) ) + "(id:<seq2seq4repair_space>" ) + ( router . getId ( ) ) ) + ")<seq2seq4repair_space>" ) + "<seq2seq4repair_space>just<seq2seq4repair_space>switch<seq2seq4repair_space>from<seq2seq4repair_space>" ) + oldState ) + "<seq2seq4repair_space>to<seq2seq4repair_space>" ) + ( conn . getState ( ) ) ; VirtualNetworkApplianceManagerImpl . s_logger . info ( context ) ; _alertMgr . sendAlert ( ALERT_TYPE_DOMAIN_ROUTER , router . getDataCenterId ( ) , router . getPodIdToDeployIn ( ) , title , context ) ; } } finally { _s2sVpnConnectionDao . releaseFromLockTable ( lock . getId ( ) ) ; } } } } } protected void updateRoutersRedundantState ( final List < DomainRouterVO > routers ) { } protected void recoverRedundantNetwork ( final DomainRouterVO masterRouter , final DomainRouterVO backupRouter ) { }

Fix:
throw new com . cloud . utils . exception . CloudRuntimeException ( ( "Unable<seq2seq4repair_space>to<seq2seq4repair_space>acquire<seq2seq4repair_space>lock<seq2seq4repair_space>for<seq2seq4repair_space>site<seq2seq4repair_space>to<seq2seq4repair_space>site<seq2seq4repair_space>vpn<seq2seq4repair_space>connection<seq2seq4repair_space>id<seq2seq4repair_space>" + ( conn . getId ( ) ) ) ) ;