Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occasional "Null timestamp in input" during realtime ingestion #4790

Closed
gaodayue opened this issue Sep 13, 2017 · 3 comments
Closed

Occasional "Null timestamp in input" during realtime ingestion #4790

gaodayue opened this issue Sep 13, 2017 · 3 comments
Labels

Comments

@gaodayue
Copy link
Contributor

We use druid 0.10.0 and tranquility-kafka to do realtime ingestion. Occasionally, we see NPE in realtime task log, and the error message looks fairly strange.

io.druid.java.util.common.parsers.ParseException: Unparseable timestamp found!
        at io.druid.data.input.impl.MapInputRowParser.parse(MapInputRowParser.java:75) ~[druid-api-0.10.0.jar:0.10.0]
        at io.druid.segment.realtime.firehose.EventReceiverFirehoseFactory$EventReceiverFirehose.addAll(EventReceiverFirehoseFactory.java:192) ~[druid-server-0.10.0.jar:0.10.0]
Caused by: java.lang.NullPointerException: Null timestamp in input: {timestamp=1505203571000, reach=0, passImpression=1, passReach=0, frequencyFilter=0, click=0, impres...
        at io.druid.data.input.impl.MapInputRowParser.parse(MapInputRowParser.java:67) ~[druid-api-0.10.0.jar:0.10.0]
        ... 54 more

From the error message, it's obvious that the timestamp column "timestamp" does exist and has a valid value, but Druid says "Null timestamp in input" anyway.

@gaodayue
Copy link
Contributor Author

Related code in TimestampSpec.java

// remember last value parsed
private ParseCtx parseCtx = new ParseCtx();

public DateTime extractTimestamp(Map<String, Object> input)
{
  return parseDateTime(input.get(timestampColumn));
}

public DateTime parseDateTime(Object input)
{
  DateTime extracted = null;
  if (input != null) {
    if (input.equals(parseCtx.lastTimeObject)) {
      extracted = parseCtx.lastDateTime;
    } else {
      ParseCtx newCtx = new ParseCtx();
      newCtx.lastTimeObject = input;
      extracted = timestampConverter.apply(input);
      newCtx.lastDateTime = extracted;
      parseCtx = newCtx;
    }
  }
  return extracted;
}

In this case, input of parseDateTime can't be null (timestamp column exists!), and timestampConverter.apply never returns null. So it looks like parseDateTime can't return null but it did happen occasionally.

@gaodayue
Copy link
Contributor Author

It seems that TimestampSpec is used inside "/push-events" endpoint of EventReceiverFirehose, so there can be concurrent usage of it. But the implementation is not thread-safe, there is a race condition of ParseCtx.

@gianm
Copy link
Contributor

gianm commented Sep 13, 2017

Fixed by #4791.

@gianm gianm closed this as completed Sep 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants