fasten-project / vulnerability-producer

Gathers, enriches and publishes vulnerability information to a Kafka topic.
https://www.fasten-project.eu/
Apache License 2.0
6 stars 3 forks source link

Nitrite does not support concurrent access of cache #73

Closed elanzini closed 3 years ago

elanzini commented 3 years ago

At the moment, Nitrite can only support one single vulnerability-producer accessing it. If a new one is launched, it will fail with the following error:

org.dizitart.no2.exceptions.NitriteIOException: NO2.2001: database is already opened in other process
    at org.dizitart.no2.NitriteBuilder.openOrCreateInternal(NitriteBuilder.java:466)
    at org.dizitart.no2.NitriteBuilder.openOrCreate(NitriteBuilder.java:373)
    at eu.fasten.vulnerabilityproducer.db.NitriteController.<init>(NitriteController.java:54)
    at eu.fasten.vulnerabilityproducer.VulnerabilityProducer.createParserManager(VulnerabilityProducer.java:81)
    at eu.fasten.vulnerabilityproducer.VulnerabilityProducer.start(VulnerabilityProducer.java:101)
    at eu.fasten.vulnerabilityproducer.Main.run(Main.java:134)
    at picocli.CommandLine.executeUserObject(CommandLine.java:1729)
    at picocli.CommandLine.access$900(CommandLine.java:145)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2101)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2068)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1935)
    at picocli.CommandLine.execute(CommandLine.java:1864)
    at eu.fasten.vulnerabilityproducer.Main.main(Main.java:82)

If we want to have multiple instances of the producer running at the same time, we need to figure out another way to access the cache, or perhaps have the tool look for the cache and continue without it in the case where an exception is thrown.