apify / browser-pool

A Node.js library to easily manage and rotate a pool of web browsers, using any of the popular browser automation libraries like Puppeteer, Playwright, or SecretAgent.
89 stars 14 forks source link

browserController.newPage() Cause:browserController.newPage() timed out #49

Closed beshoo closed 2 years ago

beshoo commented 3 years ago

Am using "Crawler google places" actor once I start the apify actor I have this message


apify run
Warning: You are not logged in with your Apify Account. Some features like Apify Proxy will not work. Call "apify login" to fix that.
Run: npm start

> crawler-google-places@1.0.0 start /home/beshoo/public_html/google-map/crawler-google-places-master
> node ./src/main.js

INFO  System info {"apifyVersion":"1.3.4","apifyClientVersion":"1.4.2","osType":"Linux","nodeVersion":"v14.17.6"}
WARN  The following Key-value store directory contains a previous state:
      /home/beshoo/www/google-map/dataset/key_value_stores/default
      If you did not intend to persist the state - please clear the respective directory and re-start the actor.
WARN  The following Request queue directory contains a previous state:
      /home/beshoo/www/google-map/dataset/request_queues/default
      If you did not intend to persist the state - please clear the respective directory and re-start the actor.
INFO  [Geolocation]: Location found: Damascus, Damascus Governorate, 2277, Syria, lat: 33.5130695, long: 36.3095814
WARN  Actor was restarted, skipping search step because it was already done...
INFO  PuppeteerCrawler:AutoscaledPool:Snapshotter: Setting max memory of this run to 32184 MB. Use the APIFY_MEMORY_MBYTES environment variable to override it.
INFO  PuppeteerCrawler:AutoscaledPool: state {"currentConcurrency":0,"desiredConcurrency":2,"systemStatus":{"isSystemIdle":true,"memInfo":{"isOverloaded":false,"limitRatio":0.2,"actualRatio":null},"eventLoopInfo":{"isOverloaded":false,"limitRatio":0.6,"actualRatio":null},"cpuInfo":{"isOverloaded":false,"limitRatio":0.4,"actualRatio":null},"clientInfo":{"isOverloaded":false,"limitRatio":0.3,"actualRatio":null}}}
ERROR PuppeteerCrawler: handleRequestFunction failed, reclaiming failed request back to the list or queue {"url":"https://www.google.com/maps/@33.50769912511799,36.31172733641526,17z/search","retryCount":1,"id":"GPhnSzVIulAuEaL"}
  Error: browserController.newPage() failed: 7hfF_FQCMTKYVNGku_BzF
  Cause:browserController.newPage() timed out..
      at BrowserPool._createPageForBrowser (/home/beshoo/public_html/google-map/crawler-google-places-master/node_modules/browser-pool/dist/browser-pool.js:326:19)
      at runNextTicks (internal/process/task_queues.js:60:5)
      at listOnTimeout (internal/timers.js:526:9)
      at processTimers (internal/timers.js:500:7)
      at async PuppeteerCrawler._handleRequestFunction (/home/beshoo/public_html/google-map/crawler-google-places-master/node_modules/apify/build/crawlers/browser_crawler.js:306:22)
      at async PuppeteerCrawler._runTaskFunction (/home/beshoo/public_html/google-map/crawler-google-places-master/node_modules/apify/build/crawlers/basic_crawler.js:425:13)
      at async AutoscaledPool._maybeRunTask (/home/beshoo/public_html/google-map/crawler-google-places-master/node_modules/apify/build/autoscaling/autoscaled_pool.js:408:17)

the INPUT:```

{ searchStringsArray: [ 'sport' ], country: 'usa', city: 'CL', county: '', postalCode:'', maxCrawledPlaces: 99999, maxCrawledPlacesPerSearch: 1000, maxReviews: 20, language: 'en', maxImages: 1, includeHistogram: true, includeOpeningHours: true, includePeopleAlsoSearch: false, additionalInfo: false, reviewsSort: 'mostRelevant', reviewsTranslation: 'onlyTranslated', exportPlaceUrls: false, zoom: 17, maxAutomaticZoomOut: 13,

proxyConfig: { useApifyProxy: false, }, maxConcurrency: 20, maxPageRetries: 2, pageLoadTimeoutSec: 60, maxPagesPerBrowser: 10, useChrome: false, useStealth: false, scrapeReviewerName: true, scrapeReviewerId: true, scrapeReviewerUrl: true, scrapeReviewId: true, scrapeReviewUrl: true, scrapeReviewerName:true, scrapeResponseFromOwnerText: true, debug:false, }

AndreyBykov commented 3 years ago

@beshoo I can't reproduce it, it seems to be working just fine for me. Is this still relevant?

AndreyBykov commented 2 years ago

Wasn't able to reproduce and haven't seen it in a while. Closing.

ThomasMeetKai commented 2 years ago

Try this https://stackoverflow.com/questions/64527696/firebase-functions-times-out-when-using-puppeteers-browser-newpage

AndreyBykov commented 2 years ago

@ThomasMeetKai the issue above is over 1 year old, the reproducible example is of the same age. It uses the super old puppeteer version and also firebase-functions package + it does not use Apify SDK at all. When I tried to run it - I got Error: process.env.GCLOUD_PROJECT is not set. So I could not really try it.

ThomasMeetKai commented 2 years ago

Yeah totally, just for anyone who had the same issue as above (like I did just now) I thought I would put the link to use the flags mentioned. It worked for me.

AndreyBykov commented 2 years ago

@ThomasMeetKai ah, I thought you were referring to the Stackoverflow page so that I would be able to reproduce it :) got it now 👍