Ingest does not close its factories

When you implement an ingest factory which implements `Closeable`:

```java
public static final class Factory extends AbstractProcessorFactory<MyProcessor> implements Closeable {
    @Override
    public void close() throws IOException {
        logger.debug("closing my processor factory");
    }
}
```

The `close()` method is never called which could lead to some leak threads when we close a node.

The `ProcessorsRegistry#close()` method exists though and seems to do the right job:

```java
@Override
public void close() throws IOException {
    List<Closeable> closeables = new ArrayList<>();
    for (Processor.Factory factory : processorFactories.values()) {
        if (factory instanceof Closeable) {
            closeables.add((Closeable) factory);
        }
    }
    IOUtils.close(closeables);
}
```

But apparently this method is never called in `Node#stop()`.

Closes #17625.
This commit is contained in:
David Pilato 2016-04-08 18:19:57 +02:00
parent df8a971966
commit 09fc9485c6
2 changed files with 2 additions and 0 deletions

View File

@ -70,6 +70,7 @@ public class IngestService implements Closeable {
@Override
public void close() throws IOException {
pipelineStore.getProcessorRegistry().close();
pipelineStore.close();
}

View File

@ -198,6 +198,7 @@ public class NodeService extends AbstractComponent implements Closeable {
@Override
public void close() throws IOException {
ingestService.close();
indicesService.close();
}
}