I have a program written in C# that creates AdWords campaigns starting from the creation of an Account and then adding campaigns, adgroups, ads, keywords, configurations and more. It can be seen as a pipeline of processes, one after the other, and it stops if a previous process fails.
At random points of the pipeline I'm constantly facing a CONCURRENT_MODIFICATION error, and the description doesn't help much. It not always fails but it occurs in more than 50% of the launches. This is the description of the exception:
AdWordsApiException: One or more AdWords API errors have occurred. A concurrency problem occurred as two threads were attempting to modify same object.. (Error: DatabaseError.CONCURRENT_MODIFICATION, FieldPath: , Trigger: )
I haven't been able to determine the cause of the problem because (1) It happens at different levels of the pipeline and (2) it is not a multithreaded system, so there aren't other threads modifying the same object.
How can I avoid this error? Thanks