wiktorn / Overpass-API

Overpass API docker image
MIT License
134 stars 48 forks source link

Sometime update got stuck #42

Closed yanngv29 closed 4 years ago

yanngv29 commented 4 years ago

Hi,

Sometime, the update process got stuck with this message (repeated durings hours ....) :

INFO: Using replication server at http://download.openstreetmap.fr/replication/europe/france/minute/
DEBUG: Using given sequence ID 4039576
DEBUG: Starting download at ID 4039577 (max 100 MB)
DEBUG: Loading state info None failed with: <urlopen error [Errno 99] Cannot assign requested address>
Empty version, skipping file
<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.6" generator="libosmium/2.15.4">
</osm>
Update finished with status code: 3

it seems that pyosmium-get-changes got an error at certain point ? but why ?

wiktorn commented 4 years ago

Does the updates continue on next try?

I did some Google'ing here are some thing you may try: https://stackoverflow.com/questions/11981933/python-urllib2-cannot-assign-requested-address

But in your case, I find it really hard to believe, that you're running out of ports, as you need to make more connections than all available local ports to download.openstreetmap.fr. On my system:

$ cat /proc/sys/net/ipv4/ip_local_port_range
32768   60999

It's ~28k (60999-32768).

Please check if you have connections open or half open (in TIME_WAIT state) towards download.openstreetmap.fr, both inside the docker or on host.

yanngv29 commented 4 years ago

Thanks for the answer. Today after a full server night restart, it's working again. i will monitor logs during several days to see if it come again.

Is it possible that when pyosmium download changes, it use one socket per file and not release it ? in this case, i have more than 28k minutes changes files to retrieve over all docker overpass containers ..

INFO: Using replication server at http://download.openstreetmap.fr/replication/europe/france/minute/
DEBUG: Using given sequence ID 4041693
DEBUG: Starting download at ID 4041694 (max 100 MB)
Empty version, skipping file
<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.6" generator="libosmium/2.15.4">
</osm>
Update finished with status code: 3
INFO: Using replication server at http://download.openstreetmap.fr/replication/europe/france/minute/
DEBUG: Using given sequence ID 4041693
DEBUG: Starting download at ID 4041694 (max 100 MB)
DEBUG: Downloaded change 4041694. (102400 kB available in download buffer)
DEBUG: Downloaded change 4041695. (102398 kB available in download buffer)
/app/bin/update_database --version=2020-05-29T05:54:08Z --compression-method=gz --map-compression-method=gz --flush-size=16 --meta
Reading XML file ... finished reading nodes. Flushing to database ...... done.
Reading XML file ... finished reading ways. Flushing to database ...... done.
Flushing to database ....... done.
Update complete.
There are still some updates remaining
INFO: Using replication server at http://download.openstreetmap.fr/replication/europe/france/minute/
DEBUG: Using given sequence ID 4041695
DEBUG: Starting download at ID 4041696 (max 100 MB)
DEBUG: Downloaded change 4041696. (102399 kB available in download buffer)
/app/bin/update_database --version=2020-05-29T05:55:35Z --compression-method=gz --map-compression-method=gz --flush-size=16 --meta
Reading XML file ... finished reading nodes. Flushing to database ...... done.
Reading XML file ... finished reading ways. Flushing to database ...... done.
Flushing to database ....... done.
Update complete.
There are still some updates remaining
INFO: Using replication server at http://download.openstreetmap.fr/replication/europe/france/minute/
DEBUG: Using given sequence ID 4041696
DEBUG: Starting download at ID 4041697 (max 100 MB)
Empty version, skipping file
<?xml version='1.0' encoding='UTF-8'?>
<osm version="0.6" generator="libosmium/2.15.4">
</osm>
Update finished with status code: 3
wiktorn commented 4 years ago

I did some research on the internet on time waits and urllib in python.

But also I did a test on download.openstreetmap.fr server and downloading few thousands (~3500) of diffs resulted in mostly one connection active, sometimes there were some connections left with TIME_WAIT state, but only a few.

So it shouldn't be the case. I guess you need to debug further your system and I don't think this is anything within overpass that's broken.

yanngv29 commented 4 years ago

i could not do the bug again (even after install or reinstall multiple server). so i close the issue.