Skip to content

Commit

Permalink
Ingest does not close its factories
Browse files Browse the repository at this point in the history
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 elastic#17625.
  • Loading branch information
dadoonet committed Apr 8, 2016
1 parent df8a971 commit 09fc948
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public IngestInfo info() {

@Override
public void close() throws IOException {
pipelineStore.getProcessorRegistry().close();
pipelineStore.close();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public IngestService getIngestService() {

@Override
public void close() throws IOException {
ingestService.close();
indicesService.close();
}
}

0 comments on commit 09fc948

Please sign in to comment.