Open henare opened 8 years ago
I've forked it and get the same result. As far as I know status code 255 only happens on a failed compile or when you try to stop a scraper and the container has disappeared so we definitely shouldn't be seeing this.
In a local morph instance, this runs successfully but appears to run 4 times, which seems odd?
Injecting configuration and compiling...
[1G [1G-----> Ruby app detected
[1G-----> Compiling Ruby
[1G-----> Using Ruby version: ruby-2.0.0
[1G-----> Installing dependencies using bundler 1.11.2
[1G Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
[1G Fetching gem metadata from https://rubygems.org/.........
[1G Fetching version metadata from https://rubygems.org/...
[1G Fetching dependency metadata from https://rubygems.org/..
[1G Fetching https://github.com/openc/sqlite_magic.git
[1G Fetching https://github.com/openaustralia/scraperwiki-ruby.git
[1G Fetching https://github.com/everypolitician/wikidata-fetcher.git
[1G Fetching https://github.com/everypolitician/wikisnakker
[1G Rubygems 2.0.14.1 is not threadsafe, so your gems will be installed one at a time. Upgrade to Rubygems 2.1.0 or higher to enable parallel gem installation.
[1G Installing coderay 1.1.0
[1G Installing colorize 0.7.7
[1G Installing diskcached 1.1.2
[1G Installing unf_ext 0.0.7.2 with native extensions
[1G Installing excon 0.49.0
[1G Installing multipart-post 2.0.0
[1G Installing hashie 3.4.4
[1G Installing httpclient 2.7.1
[1G Installing json 1.8.3 with native extensions
[1G Installing method_source 0.8.2
[1G Installing mime-types 2.99.1
[1G Installing mini_portile2 2.0.0
[1G Installing netrc 0.11.0
[1G Installing open-uri-cached 0.0.5
[1G Installing slop 3.6.0
[1G Installing sqlite3 1.3.11 with native extensions
[1G Using wikisnakker 0.0.1 from https://github.com/everypolitician/wikisnakker (at master@a9d6711)
[1G Using bundler 1.11.2
[1G Installing unf 0.1.4
[1G Installing faraday 0.9.2
[1G Installing nokogiri 1.6.7.2 with native extensions
[1G Installing pry 0.10.3
[1G Using sqlite_magic 0.0.6 from https://github.com/openc/sqlite_magic.git (at master@4df975e)
[1G Installing domain_name 0.5.20160310
[1G Installing faraday_middleware 0.10.0
[1G Using scraperwiki 3.0.1 from https://github.com/openaustralia/scraperwiki-ruby.git (at morph_defaults@fc50176)
[1G Installing http-cookie 1.0.2
[1G Installing wikidata-client 0.0.10
[1G Installing faraday-cookie_jar 0.0.6
[1G Installing rest-client 1.8.0
[1G Installing mediawiki_api 0.5.0
[1G Using wikidata-fetcher 0.15.0 from https://github.com/everypolitician/wikidata-fetcher.git (at master@601deba)
[1G Bundle complete! 10 Gemfile dependencies, 32 gems now installed.
[1G Gems in the groups development and test were not installed.
[1G Bundled gems are installed into ./vendor/bundle.
[1G Bundle completed (125.53s)
[1G Cleaning up the bundler cache.
[1G
[1G [1G-----> Discovering process types
[1G Procfile declares types -> scraper
Injecting scraper and running...
2013 election
= 64 people
Wikidata lookup
Fetching 800 items
2013 election
= 64 people
Wikidata lookup
Fetching 800 items
= 237 recent
2013 election
= 64 people
Wikidata lookup
Fetching 800 items
= 237 recent
2013 election
= 64 people
Wikidata lookup
Fetching 800 items
= 237 recent
DONE!
⁇ Unknown claim: https://www.wikidata.org/wiki/Property:P2218 for Q15719117
When I first ran the forked scraper it got 100 items. Running it a second time resulted in a empty database.
Running locally for a second time it seems to loop but differently (!?!):
Injecting configuration and compiling...
Injecting scraper and running...
2013 election
= 64 people
Wikidata lookup
Fetching 800 items
2013 election
= 64 people
Wikidata lookup
Fetching 800 items
= 237 recent
2013 election
= 64 people
Wikidata lookup
Fetching 800 items
= 237 recent
⁇ Unknown claim: https://www.wikidata.org/wiki/Property:P2218 for Q15719117
DONE!
It's still completing successfully. We also got a copy of the problematic production database and ran the scraper over that locally and it worked OK, saving 237 records into the database OK.
@tmtmtmtm this is really weird. As you can see above, when we run this in a local instance of morph the scraper appears to loop. This seems to be a problem with the scraper, not morph. Are you able to get to the bottom of that?
Admittedly this doesn't resolve the real problems we're seeing with this scraper on production morph but we want to understand that first before moving onto more troubleshooting.
Another example if that helps. https://morph.io/planningalerts-scrapers/melbourne
@LoveMyData that's a big help, thanks!
It seems like that scraper stopped running successfully on the 19th of July and hasn't finished successfully since. Interestingly there's been runs of @tmtmtmtm's that have been successful since that date.
Running https://morph.io/planningalerts-scrapers/melbourne on a local instance of morph works fine.
Another thing worth noting is that the PlanningAlerts scraper stops logging output some of the way through. In the most recent run it only logs output for 25 development application detail pages, whereas locally it outputs all of them, which is 62 detail pages. (This means a total of 57 lines on morph and 70 locally).
I just ran the PlanningAlerts scraper and the run finished OK but there was an error with the scraper:
Injecting configuration and compiling...
[1G [1G-----> Ruby app detected
[1G-----> Compiling Ruby
[1G-----> Using Ruby version: ruby-2.2.4
[1G-----> Installing dependencies using bundler 1.11.2
[1G Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
[1G Fetching gem metadata from https://rubygems.org/.........
[1G Fetching version metadata from https://rubygems.org/..
[1G Fetching https://github.com/openaustralia/scraperwiki-ruby.git
[1G Installing mime-types 2.99.1
[1G Installing unf_ext 0.0.7.2 with native extensions
[1G Installing httpclient 2.7.2
[1G Installing net-http-digest_auth 1.4
[1G Installing net-http-persistent 2.9.4
[1G Installing mini_portile2 2.0.0
[1G Installing ntlm-http 0.1.1
[1G Installing webrobots 0.1.2
[1G Using bundler 1.11.2
[1G Installing sqlite3 1.3.11 with native extensions
[1G Installing nokogiri 1.6.7.2 with native extensions
[1G Installing unf 0.1.4
[1G Installing domain_name 0.5.20160310
[1G Installing http-cookie 1.0.2
[1G Installing sqlite_magic 0.0.6
[1G Using scraperwiki 3.0.1 from https://github.com/openaustralia/scraperwiki-ruby.git (at morph_defaults@fc50176)
[1G Installing mechanize 2.7.4
[1G Bundle complete! 2 Gemfile dependencies, 17 gems now installed.
[1G Gems in the groups development and test were not installed.
[1G Bundled gems are installed into ./vendor/bundle.
[1G Bundle completed (25.02s)
[1G Cleaning up the bundler cache.
[1G
[1G ###### WARNING:
[1G You have not declared a Ruby version in your Gemfile.
[1G To set your Ruby version add this line to your Gemfile:
[1G ruby '2.2.4'
[1G # See https://devcenter.heroku.com/articles/ruby-versions for more information.
[1G
[1G [1G-----> Discovering process types
[1G Procfile declares types -> scraper
Injecting scraper and running...
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=1
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=2
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=3
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=4
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=5
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=6
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=7
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?std=29/08/2016&end=12/09/2016&page=8
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=261516
Skipping already saved record TP-2005-811/B
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=261515
Skipping already saved record TP-2005-815/B
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=261490
Skipping already saved record TP-2016-757
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=261493
Skipping already saved record TP-2016-758
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=261496
Skipping already saved record TP-2016-759
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=261498
Skipping already saved record TP-2016-760
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=238088
Skipping already saved record TP-2016-755
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=238090
Skipping already saved record TP-2016-756
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237816
Skipping already saved record TP-1999-1133/A
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237809
Skipping already saved record TP-2016-743
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237812
Skipping already saved record TP-2016-744
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237814
Skipping already saved record TP-2016-745
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237828
Skipping already saved record TP-2016-746
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237832
Skipping already saved record TP-2016-747
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237834
Skipping already saved record TP-2016-748
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237984
Skipping already saved record TP-2016-749
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=238043
Skipping already saved record TP-2016-750
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=238052
Skipping already saved record TP-2016-751
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=238053
Skipping already saved record TP-2016-752
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=238055
Skipping already saved record TP-2016-753
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=238056
Skipping already saved record TP-2016-754
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237404
Skipping already saved record TP-2016-740
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237410
Skipping already saved record TP-2016-741
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=237707
Skipping already saved record TP-2016-742
Fetching http://www.melbourne.vic.gov.au/building-and-development/property-information/planning-building-registers/Pages/town-planning-permits-register-search-results.aspx?appid=316
/app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.4/lib/mechanize/http/agent.rb:1166:in `auto_io': Cannot allocate memory @ io_write - /tmp/mechanize-gunzip20160912-18-zk96as (Errno::ENOMEM)
from /app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.4/lib/mechanize/http/agent.rb:434:in `content_encoding_gunzip'
from /app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.4/lib/mechanize/http/agent.rb:818:in `response_content_encoding'
from /app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.4/lib/mechanize/http/agent.rb:283:in `fetch'
from /app/vendor/bundle/ruby/2.2.0/gems/mechanize-2.7.4/lib/mechanize.rb:464:in `get'
from scraper.rb:30:in `block in <main>'
from scraper.rb:28:in `each'
from scraper.rb:28:in `<main>'
Cannot allocate memory @ io_write
There's plenty of disk and ram on the server so I don't know what this is about.
Here's an idea - could these scrapers be exhausting their container's RAM and that's what's causing the weird error message? We might be getting odd error messages because of the log limiter wrapper that's relatively recently been implemented.
Ah ha! I just deliberately created a scraper that would exhaust memory and, what do you know, the output oddly stops and the run fails with status code 255:
https://morph.io/morph-test-scrapers/morph-hansard
@tmtmtmtm do you think that could be the problem you're seeing?
@henare it's certainly possible that this is a memory issue (though in other scrapers with memory issues, morph simply kills the process). I could try lowering the batch_size
argument to see if it makes any difference, but I need morph to come alive again to do that…
Running it a second time resulted in a empty database.
The scraper explicitly clears out the database before each run, so that part is to be expected if the scraper fails.
when we run this in a local instance of morph the scraper appears to loop. This seems to be a problem with the scraper, not morph. Are you able to get to the bottom of that?
Nope. That's definitely not something the scraper is doing. As you can see from the scraper code the warn "2013 election"
, for example, is at the very top of the file: https://github.com/everypolitician-scrapers/argentina-diputados-wikidata/blob/master/scraper.rb#L6, not within any sort of loop. Something about the way morph is running it must be triggering a restart before it errors out.
I need morph to come alive again to do that
morph is... not alive?! Oh brother.
It looks like the CPUs have been pegged for the last 12+ hours:
Console:
I've issued a reboot from the Linode dashboard and the site's back. I guess it will take ages to clear the scraper queue though :disappointed:
I guess it will take ages to clear the scraper queue though
I just ran the test scraper and it's working.
Is there any way around this issue? I keep having a scraper give me this code and my guess is I'm overloading the RAM. Can I add breaks or something? Thanks.
Hi @walinchus :wave: please ask questions related to scrapers in the forum :point_right: https://help.morph.io/
Ah no problem thanks @henare!
@tmtmtmtm reported that: