Closed adityaalemnisk closed 8 months ago
Hi,
I've tried to reproduce the issue you're seeing, but I'm not getting that error.
Is there any additional information from your logs? I see the image shows there were details about an error before the portion in the screenshot. If you could copy/paste any other log information as text (instead of as a screenshot) that'd be helpful.
When does this error occur? Within the loop, when the process is shutting down, or at some other time?
As an aside, I recommend reusing the UserDataServiceClient
instead of creating a new instance for every iteration of the loop. The way you're doing it still works, but it's much more efficient to reuse a single service client across requests. You can still send those requests to different customer_id
s using a single service client as long as the OAuth credentials or login_customer_id
doesn't change.
Thanks, Josh, Google Ads API Team
Mar 01, 2024 6:52:40 AM io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference cleanQueue
SEVERE: ~~~ Previous channel ManagedChannelImpl{logId=67, target=googleads.googleapis.com:443} was garbage collected without being shut down! ~~~
Make sure to call shutdown()/shutdownNow()
java.lang.RuntimeException: ManagedChannel allocation site
at io.grpc.internal.ManagedChannelOrphanWrapper$ManagedChannelReference.
CrashReporter : Already enabled! CrashReporter : Already enabled!
I see the image shows there were details about an error before the portion in the screenshot ---> thats the same error as pasted above. Its repeating itself When does this error occur? Within the loop, when the process is shutting down, or at some other time? ---> its coming again and again whenever this is called
try (UserDataServiceClient userDataServiceClient =
googleAdsClient.getLatestVersion().createUserDataServiceClient())
The error is coming when createUserDataServiceClient is called. I had tried to move it outside the loop but then also I was receiving the same error. I tried to use shutdown/shutdownNow as suggest by the error but it didnt do anything. The above error is coming for v14, v15 and v16. With v13 I am getting the response --->
{ request_error: UNKNOWN_ENUM_VALUE_RequestError_38 } message: "Version v13 is deprecated. Requests to this version will be blocked."}
Our application works like we have multiple clients with different credentials and there is a file reader class which is called by a thread pool. The file reader class reads multiple files and calls the class google uploader service.
Hi,
Could you share your dependencies as described in our Advanced usage guide? It's possible that your runtime has inconsistent/incompatible dependencies that are leading to that error.
Another option is to change your dependency on this library from:
com.google.api-ads:google-ads:30.0.0
to:
com.google.api-ads:google-ads-shadowjar:30.0.0
And see if that resolves the issue. If it does, that means that the error is stemming from a dependency conflict.
Thanks, Josh
Hi, These are the dependencies we were using
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>ads-lib</artifactId>
<version>4.15.1</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>google-ads</artifactId>
<version>30.0.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.23.0</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
</exclusions>
</dependency>
On using the shaded version of google-ads the issue is resolved and I am able to see successful uploads.
Can you also help me with the maximum number of users that we can upload for a single account with basic access using UserDataServiceClient. What I understand from the documentation is that we can have 15K api calls per day and with UserDataServiceClient we can have 10 unique user identifiers with ADD operation in a single api call that takes up the total to 150K users uploaded per account per day.
Hi,
Thanks for trying out the shaded jar. Before switching to that, I would recommend removing the following section entirely because the com.google.api-ads:ads_lib
library is for the old AdWords API that shut down over a year ago:
<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>ads-lib</artifactId>
<version>4.15.1</version>
<exclusions>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
<exclusion>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
</exclusions>
</dependency>
I would not be surprised if removing that dependency on com.google.api-ads:ads-lib
fixes the problem without having to use the shaded jar. I'd only recommend using the shaded jar if you can't resolve dependency problems in any other way.
Regarding limits with Basic Access, you can have 15,000 API operations per day. With UserDataService
, each request counts as 1 operation, so that's equivalent to 15,000 UserDataService
requests per day if that's the only type of request you're sending.
https://developers.google.com/google-ads/api/docs/best-practices/quotas
Each UserDataService
request can have up to 10 operations. So combined with the 15,000 requests/day limit, that means you can add or remove 15,000 * 10 = 150,000
members from user lists each day. However, if you're approaching that limit, you may want to use the asynchronous OfflineUserDataJob
approach instead, as it's going to be much more efficient than using UserDataService
.
Thanks, Josh
Hi Josh, Thanks for your help. I was able to resolve the error using shadow-jar mentioned in the advanced usage.
What is your question? We have just migrated from v13 to v16 for google ads api and seeing error.
We have just migrated from v13 to v16 for google ads api and seeing error when userDataServiceClient = googleAdsClient.getLatestVersion().createUserDataServiceClient(); is called. code implementation :