Skip to content

Timer task is disposed due to restartTimerOnMaxSize leading to data loss #806

@OrezzerO

Description

@OrezzerO

Steps to reproduce:

  1. Submit data fast enough,
  2. If timer is running while buffer is full ,timer task will be disposed.

We can see it in :

public void onNext(T t) {
U b;
synchronized (this) {
b = buffer;
if (b == null) {
return;
}
b.add(t);
if (b.size() < maxSize) {
return;
}
buffer = null;
producerIndex++;
}
if (restartTimerOnMaxSize) {
timer.dispose();
}
fastPathOrderedEmitMax(b, false, this);
try {
b = Objects.requireNonNull(bufferSupplier.get(), "The supplied buffer is null");
} catch (Throwable e) {
Exceptions.throwIfFatal(e);
cancel();
downstream.onError(e);
return;
}
synchronized (this) {
buffer = b;
consumerIndex++;
}
if (restartTimerOnMaxSize) {
timer = w.schedulePeriodically(this, timespan, timespan, unit);
}
}

This bug will lead to #793. I think setting restartTimerOnMaxSize to false will be a good choice. Or we can add a flag when task is running and do not dispose the timer task.

Specifications:

  • Client Version: 6.7.0
  • InfluxDB Version: 2.6.1
  • JDK Version: 11
  • Platform: linux

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