Having followed various support tickets in relation to exporting reports ( V2) programmatically I was able to use the sample in
T275059/how-to-create-and-setup-an-xtrareport-report-for-exporting-to-a-stream-in-a-non-xaf to create and export reports in a workflow using the InvokeMethod activity and return a stream to pass to a custom SMTP email activity.
The reports actually worked and emails were sent on the first attempt amazingly enough however after a number of reports ( approx. 100) were generated they stopped.
My initial reaction was to assume memory leaks with all the streaming however when I examined the Workflow history I found this error in the execution log.
C#Fault info:
Activity: InvokeMethod
Exception Message: Unable to open database. Connection string: 'Server= tcp:*********;Database= *******;User ID=**********;Password=***REMOVED***;Trusted_Connection= False;Encrypt= True;Connection Timeout= 30;'; Error: 'System.InvalidOperationException: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size was reached.
at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection)
at System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions)
at System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry)
From looking at other Pooling related tickets I know now that each time the workflow runs a new ObjectSpaceProvider is created taking a connection from the pool however I don't know anyway to recycle the handle to the provider within the context of the WorkflowServer service. Should the code be explicitly disposing of the helper objects after each run?
Its a pity we cant use the ObjectSpace from the Workflow application to create the reports as the current approach seems to be a bit of a heavyweight operation anyhow.
I wonder if there could be any recommended alternative approach that can be tried.
Many thanks in advance
Brian
Hello Brian,
We need additional time to answer your question. Please bear with us. We will get back to you as soon as possible.