Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avilable memory exhausted in Google/Protobuf/Internal/Message.php on line 130 #1057

Open
michalb314 opened this issue Dec 11, 2024 · 10 comments
Labels
bug Something isn't working triage Need triage

Comments

@michalb314
Copy link

Your client library and Google Ads API versions:

  • Client library version: v25.0.0
  • Google Ads API version: V18

Your environment:

  • The PHP version: 8.1.
  • The name and version of the operating system: Linux 7ff3257dd078 6.10.14-linuxkit #1 SMP Thu Oct 24 19:28:55 UTC 2024 aarch64# - a docker image
  • Whether the PHP Extension protobuf is used or not: NO, a Composer library is used.
  • Whether the PHP Extension grpc is used or not: YES, 1.68.0, but the problem persists without it.
  • The type of transport being used (grpc or rest): grpc

Description of the bug:
I switched to v18 version of the API. I updated the client version to v25 and updated all the calls i'm making. Most of the calls make it through and return data. Larger call that requests data from search_term_view reports a memory exhausted error.
I tried using search() - the memory error is returnd the moment i call the search function
I tried using searchStream() - the call goes through, and the memory error is returned the moment i try to call iterateAllElements() on the result of the call.
The error is: "Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /var/www/html/vendor/google/protobuf/src/Google/Protobuf/Internal/Message.php on line 130"
I made sure i'm using the latest version of the protobuf composer package, the version is v4.29.1
I know for a fact, that the call i'm trying to make is returning around 7k rows(i checked on google ads) AND it worked previously when the app was used.
I don't know if i can paginate the results of searchstream() - there's no documentation about that, or i couldn't find it.
I can't set the pageSize of search(), the option is deprecated, so i need to fetch the whole result.
I can set "LIMIT XXX" on the query itself, but then, if i understand correctly, there's no way to "get the next page" so to speak.
I removed every single thing that i could from a function that calls the API except for the call itself, and an empty foreach that iterates on the results, and it still reports a memory error.

Anything else we should know about your project / environment:
It worked around 2 years ago. I specifically checked to see if i had everything updated. I had the same problem sometime before (up to api v14 iirc) and decided to raise the memory limit to 512MB, but right now, for a 7k result set i'd have to raise it to 2G(it goes through then), which i cannot do.
I skimmed through some issues on here and the protobuf repo and none helped.

@michalb314 michalb314 added bug Something isn't working triage Need triage labels Dec 11, 2024
@fiboknacky
Copy link
Member

Could you please send us your customer ID and Google Ads Query to googleadsapi-support@google.com? Ensure to add this GitHub issue URL so the agents there know how to pass it to me. Thanks!

@michalb314
Copy link
Author

I've sent it just now, thank you.

@Identity-labs
Copy link

Hi any news on this, we have same issue ?

it's possible to bypass result hydrate to avoid creating all value objects ? and get raw data to make it faster and less ram consuming?

Thx

@fiboknacky
Copy link
Member

@Identity-labs Could you do the same as I mentioned above, sending your details to googleadsapi-support@google.com? I assume that you have exactly same settings and requests as mentioned in comment #1.
If not, could you share more details?

@Identity-labs
Copy link

By mail i have this answer, it's joke ?

Since, it is specific to the client library of PHP, I would request you raise the issue [here](https://github.com/googleads/google-ads-php/issues?q=is%3Aissue) by clicking on the button “New issue”.

How to have power full lib who don't take almost entier ram/cpu of our server ?
It's possible to have low level api response without any value objects for rows & fields ?
it's not possible to create objects for more than 10M rows !

@fiboknacky
Copy link
Member

Could you share with me the case number that you get from sending email? I'll take a look at this. Really sorry for your inconvenience.

It's possible to have low level api response without any value objects for rows & fields ?

The gRPC and REST are the only interface that you can use to send your requests to the server.

it's not possible to create objects for more than 10M rows !

Creating 10M rows at a time is probably not a good way of using the Google Ads API anyway. You're likely to get rate limited.
The resources in this section would be useful for you when productionizing your application.

@michalb314
Copy link
Author

Hey, if anyone gets an answer that works for them, do you mind pasting it here? The experience i had with the email support is so amazing i've basically given up, i don't think those support people even understand english properly.

@fiboknacky
Copy link
Member

@michalb314 I'm sorry to hear that. Please give me the case number that is included in the emails sent to you. I'll follow up with that.

@Identity-labs
Copy link

Hi, Here the case number : "ref:!00D1U01174p.!5004Q02vH2mV:ref" (ADR-00289002)

I don't have rate, limite but it's taking hours to get data et too much cpu/ram

@fiboknacky
Copy link
Member

Thanks. I saw the case now but you haven't shared the whole log or at least the request ID yet.
Could you share the request ID here or in that email thread? Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Need triage
Projects
None yet
Development

No branches or pull requests

3 participants