RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1744856 - truncation detected, (cannot seek backward to begin of last block) - re-start reading from beginning: Inappropriate ioctl for device
Summary: truncation detected, (cannot seek backward to begin of last block) - re-start...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: rsyslog
Version: 7.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jiří Vymazal
QA Contact: Dalibor Pospíšil
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-08-23 03:41 UTC by Aniket Bhavsar
Modified: 2023-09-07 20:27 UTC (History)
3 users (show)

Fixed In Version: rsyslog-8.24.0-47.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 19:10:09 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github rsyslog rsyslog pull 3274 0 None closed bugfix imfile: rsyslog re-sends data for files larger 2GiB 2021-01-25 10:39:33 UTC
Red Hat Product Errata RHSA-2020:1000 0 None None None 2020-03-31 19:10:48 UTC

Description Aniket Bhavsar 2019-08-23 03:41:05 UTC
Description of problem:
Getting 'truncation detected, (cannot seek backward to begin of last block) - re-start reading from beginning: Inappropriate ioctl for device [v8.24.0-41.el7_7 try http://www.rsyslog.com/e/51 ]' when monitoring files with imfile and “reopenOnTruncate” has been set to “on”. 

Version-Release number of selected component (if applicable):
v8.24.0-41.el7_7

The issue does not appear with rsyslog-8.24.0-34.el7.

How reproducible:


Steps to Reproduce:

1) You can test that issue installing the rsyslog-8.24.0-41.el7_7 release and then create a queue like this one:

module(load="imfile" PollingInterval="10") #needs to be done just once

$template genericlog_rfcmsg_net,"%msg:1:$:%\n"

input(type="imfile"
      File="/tmp/testfile"
      Tag="testfile"
      Severity="debug"
      Facility="local0"
      reopenOnTruncate="on"
      freshstartTail="on")

if $programname == 'testfile' and $syslogfacility-text == 'local0' and $syslogseverity-text == 'debug' then @/dev/null;genericlog_rfcmsg_net

*.* stop

2) Then, create a test file around 2G random size, for example:

#base64 /dev/urandom | head -c 1900000000 > /tmp/testfile && ls -lh /tmp/testfile

3) And then restart the rsyslog service:

#systemctl restart rsyslog

4) Once you restarted the service, open a new terminal a follow the log of rsyslog:

#journalctl -u rsyslog -f

5) On the original terminal, start a loop to make the test file grow:

#watch -n 0.1 -d "base64 /dev/urandom | head -c 1000000 >> /tmp/testfile && ls -lh /tmp/testfile"

Let grow the file till around 5.5G and you can see on the journalctl file that the rsyslog will complain with some like this:

Aug 23 08:51:59 rhel7u5-1.gsslab.pnq.redhat.com rsyslogd[1661]: file '/tmp/testfile': truncation detected, (cannot seek backward to begin of last block) - re-start reading from beginning: Inappropriate ioctl for device [v8.24.0-41.el7_7 try http://www.rsyslog.com/e/51 ]

Now, stop the loop, downgrade rsyslog:

yum downgrade rsyslog-8.24.0-34.el7

and repeat the whole test recreating the testfile. You will see that rsyslog will not complain about anything.

Problem:
Re-reading the whole file it's a problem and generate duplicate entry on the destination file, and also is a problem in matter of network if the original file is shared somehow via network.

Actual results:

Journal logs:
file '/tmp/testfile': truncation detected, (cannot seek backward to begin of last block) - re-start reading from beginning: Inappropriate ioctl for device [v8.24.0-41.el7_7 try http://www.rsyslog.com/e/51 ].

When I visited 'http://www.rsyslog.com/e/51' found the description of this:

~~~~~
File has been truncated This is not a real error but rather a warning message. Most probably it occurs when monitoring files with imfile and “reopenOnTruncate” has been set to “on”. In this case, it indicates truncation of the file has been detected, and as such imfile begins to read it’s content from the beginning
~~~~~

Comment 13 errata-xmlrpc 2020-03-31 19:10:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2020:1000


Note You need to log in before you can comment on or make changes to this bug.