Many connections to SQL from AOS dax 2012

The other day I was confronted with problem of lost AOS coonections to SQL. It happens then I try to post several large ledger journals in parralel tasks. I founded some problems with number of connections. Then posting is running number of connections to hight. I founded it with SQL script
Version Dax 2012 R2


SELECT ec.client_net_address, es.[program_name], es.[host_name], es.login_name, 
COUNT(ec.session_id) AS [connection count] 
FROM sys.dm_exec_sessions AS es WITH (NOLOCK) 
INNER JOIN sys.dm_exec_connections AS ec WITH (NOLOCK) 
ON es.session_id = ec.session_id 
GROUP BY ec.client_net_address, es.[program_name], es.[host_name], es.login_name  
ORDER BY ec.client_net_address, es.[program_name] OPTION (RECOMPILE);


It happens because UserConnection class must call finalize method. Like this
This code example from DimensionStorage.savePrivate() class.
Also Statement and ResultSet class must be closed. Code example.

This code example from LedgerJournalTable.numOfVouchers() table.

I added code like this in next objects:
Tables
DimensionAttributeValueNamesTmp.generateDimensionAttributeValueNames()
DimensionAttributeValueNamesTmp.updateDimAttrValueNamesTmpDesc()
DimensionFocusNameTmp.generateFocusDescriptions()
DimensionFocusNameTmp.generateFocusDescriptionsDefaultDim()
DimensionFocusNameTmp.generateFocusValues()
LedgerJournalTable.numOfVouchers()
LedgerTransAccountTmp.updateStatistics()
Classes
DimensionAttributeValueSetStorage.saveValueSetOnServer()
DimensionAttributeValueGroupValidation.insertStatusRecord()
DimensionAttributeSetStorage.saveSetOnServer()
DimensionStorage.savePrivate()
DimensionValidation.insertStatusRecord()
DimensionValidation.clearCacheForAccountStructureChange()
DimensionValidation.updateCacheForCompanyValueChange()
DimensionValidation.updateCacheForHierarchyChange()
DimensionValidation.updateCacheForRuleChange()
DimensionValidation.validateByJournalName()
SubledgerJournalTransferCommand.generateJournalNumbers()
SubledgerJournalTransferCommand.getSchemaName()

After connections close normally and number of parrallel connections not increasing.

Comments

Popular posts from this blog

How to post transfer order from code X++