You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2020/01/13 18:01:00 UTC
[jira] [Commented] (NIFI-6923) If FlowFile content is truncated in
the Content Repository, NiFi does not throw Exception when reading the
content
[ https://issues.apache.org/jira/browse/NIFI-6923?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17014530#comment-17014530 ]
ASF subversion and git services commented on NIFI-6923:
-------------------------------------------------------
Commit ccb85cf8b7e6ee98e1e800e5db93c0a0c3b81feb in nifi's branch refs/heads/master from mdayakar
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=ccb85cf ]
NIFI-6923:If FlowFile content is truncated in the Content Repository, NiFi does not throw Exception when reading the content.
NIFI-6923 fixing checkstyle
> If FlowFile content is truncated in the Content Repository, NiFi does not throw Exception when reading the content
> ------------------------------------------------------------------------------------------------------------------
>
> Key: NIFI-6923
> URL: https://issues.apache.org/jira/browse/NIFI-6923
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Reporter: Mark Payne
> Assignee: Dayakar Morem
> Priority: Major
> Time Spent: 10m
> Remaining Estimate: 0h
>
> If the content of a FlowFile is truncated in the Content Repository, whenever NiFi attempts to read the content, it should throw a ContentNotFoundException because only part of the content was available. This is handled by the `FlowFileAccessInputStream` in the `ensureAllContentRead` method.
> However, in some cases this doesn't happen. To replicate, create the following flow:
> GenerateFlowFile -> MergeContent.
> In GenerateFlowFile, choose to use a batch size of 1000 FlowFiles, each 1 KB in size. Run the Processor once. Then, use vi to truncate a few bytes from the end of the file in the content repository. Then, run MergeContent. The processor *should* throw an Exception but doesn't.
> I think the problem is that the `FlowFileAccessInputStream.read(byte[])` calls `super.read(byte[])`. This, in turn, calls `FlowFileAccessInputStream.read(byte[], int, int)`, which increments `bytesConsumed`. This method then returns, as does the super call. Then, the `FlowFileAccessInputStream.read(byte[])` call increments `bytesConsumed` again.
> Instead, the InputStream should just delegate to `read(byte[], int, int)` directly when `read(byte[])` is called instead of delegating to `super.read(byte[], int, int)`.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)