komoot / photon

an open source geocoder for openstreetmap data
Apache License 2.0
1.83k stars 278 forks source link

Ensure ImportThread is always terminated. #650

Closed codepainters closed 2 years ago

codepainters commented 2 years ago

This pull request solves the problem I observe with v0.3.5: if -nominatim-import is executed when the database is not reachable, the process never ever exits. This is due to ImportThead.finish() never being called, and thus ImportThread never terminating.

Note: this issue is no longer observable with latest code. After https://github.com/komoot/photon/commit/45b3ec75356bf795ddb63b91a734e1eb49f74801 commit NominatimConstructor reaches to the database (and fails) before ImportThread is created, effectively masking the problem.

However it can still fail, should any of the queries in readEntireDatabase() raise any exception.

lonvia commented 2 years ago

Makes perfect sense. Thank you!