none
.Net Core console application using Bulk Executor exits without error RRS feed

  • Question

  • I'm using the bulk executor in a .net Core console application to perform updates and for some reason it just exits unexpectedly after the call of BulkUpdateAsync, without any error information. I've used the examples for the .net framework version, presuming that it's basically the same logically, when using .net Core.

    Are there any examples out there using .net standard, or core. Including how to configure logging for the bulkexecutor class? Currently I've implemented a .net core console application, using serilog for logging.

    To be more precise - regarding the fact that the console application just exits unexpectedly - I had put a try catch statement around the BulkUpdateAsync statment with two catch blocks, just as in the example (with a DocumentClientException and a Exception respectively). After the BulkUpdateAsync statment a log statement follows - this is never reached however. Neither is either of the catch blocks reached. The console application just stops.

    I've noticed in the output window the following statements b.t.w.:
    Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : Sorting 100 update items into 1 partition buckets
    Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : Creating mini batches within each partition bucket
    Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : partitionRangeId = 0 currentMiniBatchSize = 18252 maxMiniBatchSize = 220201 currentMiniBatchItemCount = 100
    Sitech.Sahc.Telemetry.BulkIdCorrector Information: 0 : Beginning bulk update within each partition bucket

    Is there a minimum that you can have for a batch. I wanted to test with 100 records first, to see if everything works correctly. But that doesn't explain why the console application would just exit, without reaching one of the catch blocks.

    I've also tried to force a break by using the Exception Settings tab to force breaks on all Common Language Runtime Exceptions (and later on all exceptions. But nothing happens then either.

    Tuesday, September 3, 2019 9:43 AM

All replies

  • Hi Johan,

    Do you have logic in your client to control batch size or resource consumption? Please see: Bulk import data to Azure Cosmos DB

    There is also a logListener and consoleListener that can be leveraged to collect trace information:

    <system.diagnostics>
      <trace autoflush="false" indentsize="4">
        <listeners>
          <add name="logListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="application.log" />
          <add name="consoleListener" type="System.Diagnostics.ConsoleTraceListener" />
        </listeners>
      </trace>
    </system.diagnostics>

    Please review this is information and compare with your solution to see if there are components that can be added to address any gaps.

    Regards,

    Mike

    Tuesday, September 3, 2019 11:01 PM
    Moderator
  • It's a .Net Core application. The trace configuration example is for .Net Framework, using an app.config. How do I enable the tracing in a .Net Core application? Using the .Net Standard version of the BulkExecutor. I can't find the code for the BulkExecutor - so I don't know what logging framework you used. Are you using the ILogger interface? As I've mentioned - I'm using Serilog, with file, console and trace sinks for logging in the .net core console application. I don't know how to get your trace statements into a file.

    I've got the bulk executor working now - I've removed the away statement from the call to BulkUpdateAsync, and get the result synchronously by reading its Result property. This seems to work. So it looks as if something is wrong the the asynchronous processing in the method.




    Monday, September 9, 2019 7:19 AM
  • See also issue 64 on the Getting Started page on GitHub:

    Azure/azure-cosmosdb-bulkexecutor-dotnet-getting-started/issues/64

    (I can't add an url, therefore I've copied the path to the issue in question)


    Monday, September 9, 2019 8:57 AM
  • It is best to file an issue directly against the repository. If you need additional assistance, please feel free to email AskCosmosDB and they will respond to your questions.

    Regards,

    Mike

    Monday, September 9, 2019 9:30 PM
    Moderator
  • I've managed to solve the issue with the getting the tracing statements b.t.w. Took me some time (almost all day yesterday - also because I had added Tracing as a sink to the Serilog Logger previously - resulting in an unending loop of log statmens (oops) - but after removing the tracing sink - and fiddling around with the methods and properties a bit - I got it working :-).

    As I've mentioned - I've used SeriLog as an extra logging framework. It also has a TraceListener - I just had to attach the Serilog Logger to the interface of the BulkExecutor and attach the logger to the seriloglistener like thus:

                var listener = new SerilogTraceListener.SerilogTraceListener(Log.Logger.ForContext<IBulkExecutor>());
                Trace.Listeners.Add(listener);

    Tuesday, September 10, 2019 6:17 AM
  • B.t.w. I've also filed a ticket on the Azure Portal using my MSDN Universal subscription:

    119090924000561 

    And I just wrote an e-mail to AskCosmosDb.



    Tuesday, September 10, 2019 6:22 AM
  • Thank you for this. If you do receive a work around or a date for a fix or sample code that should address this issue, please do share this information. It is helpful to others who may be experiencing the same issue. 

    Regards,

    Mike

    Tuesday, September 10, 2019 11:03 PM
    Moderator