Skip to content

Queries can still access IncrementalIndex even after its closed.  #2299

@nishantmonu51

Description

@nishantmonu51

Below is the code snippet for RealtimePlumber where it gets a reference to incrementalIndex and then increments it in order to prevent it from closing, however before calling increment its possible for the index to be closed by another thread -

final ReferenceCountingSegment segment = input.getSegment();
// <--------- HERE some other thread can close the segment before the increment call. 
final Closeable closeable = segment.increment();

This leads to wierd NPE's after the changes done in -

Logs -

2016-01-20T01:31:39,314 INFO [mmx_metrics-incremental-persist] io.druid.segment.ReferenceCountingSegment - Closing mmx_metrics_2016-01-20T01:00:00.000Z_2016-01-20T02:00:00.000Z_2016-01-20T01:00:01.436Z, numReferences: 0
2016-01-20T01:31:39,332 ERROR [timeseries_mmx_metrics_[2016-01-20T01:00:00.000Z/2016-01-20T01:31:00.000Z]] io.druid.query.ChainedExecutionQueryRunner - Exception with one of the sequences!
java.util.NoSuchElementException
    at java.util.concurrent.ConcurrentSkipListMap.lastKey(ConcurrentSkipListMap.java:2046) ~[?:1.8.0_66]
    at io.druid.segment.incremental.IncrementalIndex.getMaxTimeMillis(IncrementalIndex.java:492) ~[druid-selfcontained-0.8.3-mmx-rc6.jar:0.8.3-mmx-rc6]
    at io.druid.segment.incremental.IncrementalIndex.getInterval(IncrementalIndex.java:546) ~[druid-selfcontained-0.8.3-mmx-rc6.jar:0.8.3-mmx-rc6]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions