ipalaus / geonames

A collection of models and commands to get all the power of GeoNames in Eloquent ORM.
MIT License
63 stars 34 forks source link

error seeding #21

Open carlituxman opened 9 years ago

carlituxman commented 9 years ago

I've executed php artisan geonames:import --country="ES" and fails after a while.

here console last output: .... Seeded: ContinentsTableSeeder Seeded: CountriesTableSeeder Seeded: AdminDivionsTableSeeder Seeded: AdminSubdivionsTableSeeder [Symfony\Component\Process\Exception\RuntimeException]
The process has been signaled with signal "11".

carlituxman commented 9 years ago

I've tried with all countries and put at importer a ini_set('memory_limit', '-1'); but: [RuntimeException]
php(690,0xa04c11d4) malloc: * mach_vm_map(size=262144) failed (error code
=3)
* error: can't allocate region
* set a breakpoint in malloc_error_break to debug
PHP Fatal error: Out of memory (allocated -746848256) (tried to allocate 3
2769 bytes) in /Users/carlituxman/dvp/laravel/geonames/vendor/ipalaus/geona
mes/src/Importer.php on line 332
php(690,0xa04c11d4) malloc:
* mach_vm_map(size=262144) failed (error code
=3)
* error: can't allocate region
* set a breakpoint in malloc_error_break to debug

carlituxman commented 9 years ago

the problem is with the last line of file allCountries.txt: 5927710 Coral Lake Coral Lak

ipalaus commented 9 years ago

Hey @carlituxman, I'll try to give it a go this week but I'm a little bit busy. Even tho, it's weird that allCountries.txt is the file that gives the error when you're trying to import the "ES" countries.

carlituxman commented 9 years ago

I need to put ini_set('memory_limit' '-1') for correct execution with ES countries. With allCountries.txt is impossible, I need unzip manually because the file only have 348mb, and the error of Coral Lake not happen, but it throws out of memory.

ipalaus commented 9 years ago

Well, that's normal as it's an intense use. I'm not sure a ini_set() should be in the core. I'm pretty sure my php.ini for CLI has a no memory limit. Using symfony/process I'm trying to get rid of most of the memory leaks that the command can generate.

You could also do php -d memory_limit=128M artisan geonames:import. Give it a go so you don't have to touch your php.ini.

carlituxman commented 9 years ago

Error after AdminSubdivionsTableSeeder [RuntimeException]
PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried t
o allocate 32769 bytes)

ipalaus commented 9 years ago

Can you do a local edit to https://github.com/ipalaus/geonames/blob/master/src/Commands/ImportCommand.php#L234 ? Add the memory limit command after the php execution and try.

carlituxman commented 9 years ago

error too

[RuntimeException]

PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 32769 bytes) in /Users/carlituxman/dvp/laravel/geonames/vendor/ipalaus/geonames/src/Importer.php

cmoralesweb commented 9 years ago

Any news on this?