Project

General

Profile

Actions

Bug #6156

closed

Enricher GeoipEnricherPlugin crashes on nonexistent GeoIP file

Added by Pavel Kácha almost 5 years ago. Updated almost 5 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
Category:
Development - Core
Target version:
Start date:
01/02/2020
Due date:
% Done:

0%

Estimated time:
To be discussed:
Yes

Description

... which causes Enricher NOT start.

It should rather yell somewhere visible and pass gracefully.

It probably was the intent, however masked exception probably seems to trigger cleanup without meeting its expectations (missing filehandle?).

2020-01-02 10:03:18,209 INFO: Module 'mentat-enricher.py': Launching instance '3'
2020-01-02 10:03:18,211 INFO: Module 'mentat-enricher.py': Waiting for worker process '60845'
2020-01-02 10:03:18,212 INFO: Module 'mentat-enricher.py': Worker process '60845' ready, executing command 'mentat-enricher.py' with arguments '['mentat-enricher.py', '--paralel']'
Traceback (most recent call last):
  File "/usr/local/bin/mentat-enricher.py", line 66, in <module>
    mentat.module.enricher.MentatEnricherDaemon().run()
  File "/var/mentat/venv/lib/python3.7/site-packages/pyzenkit/baseapp.py", line 1549, in run
    self._stage_setup()
  File "/var/mentat/venv/lib/python3.7/site-packages/pyzenkit/baseapp.py", line 1405, in _stage_setup
    self._sub_stage_setup()
  File "/var/mentat/venv/lib/python3.7/site-packages/pyzenkit/zendaemon.py", line 700, in _sub_stage_setup
    component.setup(self)
  File "/var/mentat/venv/lib/python3.7/site-packages/mentat/daemon/component/enricher.py", line 182, in setup
    self._setup_plugins(daemon)
  File "/var/mentat/venv/lib/python3.7/site-packages/mentat/daemon/component/enricher.py", line 159, in _setup_plugins
    self._setup_plugin(daemon, plugin_conf)
  File "/var/mentat/venv/lib/python3.7/site-packages/mentat/daemon/component/enricher.py", line 147, in _setup_plugin
    plugin.setup(daemon, plugin_conf.get('config', None))
  File "/var/mentat/venv/lib/python3.7/site-packages/mentat/plugin/enricher/geoip.py", line 65, in setup
    self.geoip_service = geoip_manager.service()
  File "/var/mentat/venv/lib/python3.7/site-packages/mentat/services/geoip.py", line 232, in service
    self._service.setup()
  File "/var/mentat/venv/lib/python3.7/site-packages/mentat/services/geoip.py", line 88, in setup
    self.asndb = geoip2.database.Reader(self.fn_asndb)
  File "/var/mentat/venv/lib/python3.7/site-packages/geoip2/database.py", line 86, in __init__
    self._db_reader = maxminddb.open_database(fileish, mode)
  File "/var/mentat/venv/lib/python3.7/site-packages/maxminddb/__init__.py", line 41, in open_database
    return maxminddb.reader.Reader(database, mode)
  File "/var/mentat/venv/lib/python3.7/site-packages/maxminddb/reader.py", line 51, in __init__
    with open(database, 'rb') as db_file:
FileNotFoundError: [Errno 2] No such file or directory: '/var/opt/opensourcedbs/GeoLite2-ASN.mmdb'
Exception ignored in: <function GeoipService.__del__ at 0x7f6d647bbc80>
Traceback (most recent call last):
  File "/var/mentat/venv/lib/python3.7/site-packages/mentat/services/geoip.py", line 77, in __del__
    self.asndb.close()
AttributeError: 'NoneType' object has no attribute 'close'

Related issues

Related to Mentat - Bug #6157: MaxMind changes acces to its free GeoIP dbsClosedJan Mach01/02/2020

Actions
Actions #1

Updated by Jan Mach almost 5 years ago

  • Target version changed from Backlog to 2.6
  • To be discussed changed from No to Yes

You may be right, that the error reporting could be more clean. However I think that enricher should not start in case the configuration demands some plugin to be enabled, but that plugin is unable to start due to some errors. You will absolutely notice, that the daemon does not start, you might however miss some warning or error message. You could think everything is in order while some enrichment plugins are not working at all.

Actions #2

Updated by Jan Mach almost 5 years ago

  • Subject changed from Enricher WhoisEnricherPlugin crashes on nonexistent GeoIP file to Enricher GeoipEnricherPlugin crashes on nonexistent GeoIP file
Actions #3

Updated by Jan Mach almost 5 years ago

  • Related to Bug #6157: MaxMind changes acces to its free GeoIP dbs added
Actions #4

Updated by Jan Mach almost 5 years ago

  • Status changed from New to Rejected
  • Target version changed from 2.6 to Rejected

We have come to the conclusion, that my last remarks are valid. Daemon should indeed crash, if it is configured to do something, but is unable to due to some problems like missing files. There is no point in trying to work around the problem and attempt to run, admin could not notice that something is not working.

Actions

Also available in: Atom PDF