Skip to content

Deadlock depending on order of libraries in pom.xml #396

@debedb

Description

@debedb

Using Java 1.8.0_171 on OS X 10.15.6 (19G73) -- library versions seen below.

I have a program that uses google-ads with the below dependency in pom.xml:

<dependency>
           <groupId>com.google.api-ads</groupId>
           <artifactId>google-ads</artifactId>
           <version>10.1.0</version>
       </dependency>

This authenticates and just calls listAccessibleCustomers of CustomerServiceClient. This code works fine:

       Credentials creds = UserCredentials.newBuilder()
                .setClientId( clientID )
                .setClientSecret( clientSecret )
                .setRefreshToken( refreshToken ).build();
        GoogleAdsClient client0 = GoogleAdsClient.newBuilder()
                .setCredentials( creds )
                .setDeveloperToken( devToken )
                .build();
        GoogleAdsVersion client = client0.getVersion6();
        System.out.println( 1 );
        CustomerServiceClient csCli = client.createCustomerServiceClient();
        ListAccessibleCustomersRequest custReq = ListAccessibleCustomersRequest.newBuilder().build();
        ListAccessibleCustomersResponse lacr = csCli.listAccessibleCustomers( custReq );
        System.out.println( 3 );
        String query = "SELECT campaign.id, metrics.impressions, metrics.clicks"
                + " FROM geographic_view"
                + " WHERE segments.date = '2021-01-15'";
        System.out.println( 4 );
        SearchGoogleAdsRequest request = SearchGoogleAdsRequest.newBuilder()
                .setPageSize( 1_000 )
                .setQuery( query )
                .build();
        System.out.println( 5 );
        GoogleAdsServiceClient serviceClient = client.createGoogleAdsServiceClient();
        System.out.println( 6 );
        GoogleAdsServiceClient.SearchPagedResponse response = serviceClient.search( request );
        System.out.println( 7 );
        for ( GoogleAdsRow row : response.iterateAll() )
        {
            System.out.println( row.getCampaign().getId() );
            System.out.println( row.getMetrics().getImpressions() );
        }

But once I merely add the following to pom.xml:

<dependency>
<groupId>com.google.api-ads</groupId>
<artifactId>ads-lib</artifactId>
<version>4.9.1</version>
</dependency>

It appears to get deadlocked somewhere, never returning from the listAccessibleCustomers() call. In other words, only 1 gets printed and then it gets stuck.

Running Charles, I can see that the network call returns with the customer list, but the program hangs.

On further investigation I noticed that this is order dependent. In other words, this pom.xml dependency the program above hangs in call to istAccessibleCustomers() (after printing 1, never getting to printing 3):

     <dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>ads-lib</artifactId>
            <version>4.9.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>google-ads</artifactId>
            <version>10.1.0</version>
        </dependency>

But with this one, the above program runs to completion.

   <dependency>
      <groupId>com.google.api-ads</groupId>
      <artifactId>google-ads</artifactId>
      <version>10.1.0</version>
    </dependency>
        <dependency>
            <groupId>com.google.api-ads</groupId>
            <artifactId>ads-lib</artifactId>
            <version>4.9.1</version>
        </dependency>

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions