[
https://issues.apache.org/jira/browse/NIFI-11517?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pierre Villard resolved NIFI-11517.
-----------------------------------
Resolution: Feedback Received
Apache NiFi 1.x is no longer maintained and no new release is planned on the
1.x release line. Marking as resolved as part of a cleanup operation. Please
open a new one with an updated description if this is still relevant for NiFi
2.x.
> Empty Swap File causes Log Burst on newly elected primary node
> ---------------------------------------------------------------
>
> Key: NIFI-11517
> URL: https://issues.apache.org/jira/browse/NIFI-11517
> Project: Apache NiFi
> Issue Type: Bug
> Components: Core Framework
> Affects Versions: 1.15.3
> Reporter: Jannick
> Priority: Major
>
> After a change of primary node, an error message suddenly appears in the logs
> of the newly elected primary node with message
> "[java.io|http://java.io/].IOException: Failed to read swap file because the
> file contained less than 4 bytes of data". The issue is that this error
> message is written in millisecond frequency to the logs (12:45:30,894 ,
> 12:45:30,895 , 12:45:30,896) leading to a massive burst in log volume that
> fills up the disk pretty quickly of the corresponding node. Under normal
> circumstances, only one log file per hour is written in Nifi. However, at the
> time of the alarm, over 100 log files were written per hour.
> The log files contained one recurrent error message in millisecond frequency.
> 2023-03-31 12:46:48,706 ERROR [Timer-Driven Process Thread-18]
> o.a.n.c.queue.SwappablePriorityQueue
> [java.io|http://java.io/].IOException: Failed to read swap file because the
> file contained less than 4 bytes of data
> at
> org.apache.nifi.controller.FileSystemSwapManager.createSwapDeserializer(FileSystemSwapManager.java:378)
> at
> org.apache.nifi.controller.FileSystemSwapManager.peek(FileSystemSwapManager.java:202)
> at
> org.apache.nifi.controller.FileSystemSwapManager.swapIn(FileSystemSwapManager.java:181)
> at
> org.apache.nifi.controller.queue.SwappablePriorityQueue.swapIn(SwappablePriorityQueue.java:364)
> at
> org.apache.nifi.controller.queue.SwappablePriorityQueue.migrateSwapToActive(SwappablePriorityQueue.java:307)
> at
> org.apache.nifi.controller.queue.SwappablePriorityQueue.doPoll(SwappablePriorityQueue.java:527)
> at
> org.apache.nifi.controller.queue.SwappablePriorityQueue.poll(SwappablePriorityQueue.java:509)
> at
> org.apache.nifi.controller.queue.clustered.partition.SwappablePriorityQueueLocalPartition.poll(SwappablePriorityQueueLocalPartition.java:107)
> at
> org.apache.nifi.controller.queue.clustered.SocketLoadBalancedFlowFileQueue.poll(SocketLoadBalancedFlowFileQueue.java:935)
> at
> org.apache.nifi.connectable.StandardConnection.poll(StandardConnection.java:350)
> at
> org.apache.nifi.controller.repository.StandardProcessSession.get(StandardProcessSession.java:1696)
> at
> org.apache.nifi.processors.standard.EvaluateJsonPath.onTrigger(EvaluateJsonPath.java:268)
> at
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
> at
> org.apache.nifi.controller.StandardProcessorNode.onTrigger(StandardProcessorNode.java:1273)
> at
> org.apache.nifi.controller.tasks.ConnectableTask.invoke(ConnectableTask.java:214)
> at
> org.apache.nifi.controller.scheduling.TimerDrivenSchedulingAgent$1.run(TimerDrivenSchedulingAgent.java:103)
> at org.apache.nifi.engine.FlowEngine$2.run(FlowEngine.java:110)
> at
> java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> at
> java.base/java.util.concurrent.FutureTask.runAndReset(FutureTask.java:305)
> at
> java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> at
> java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> at java.base/java.lang.Thread.run(Thread.java:829)
> 2023-03-31 12:46:48,710 ERROR [Timer-Driven Process Thread-30]
> o.a.n.c.queue.SwappablePriorityQueue Failed to swap in FlowFiles from Swap
> File
> /opt/nifi/flowfile_repository/swap/1672681508226-c8273a4b-73a6-3137-b549-f68ff51188e3-e383df46-3d36-47bc-b79c-d65182077b39.local.swap;
> Swap File appears to be corrupt!
>
> The error message complains about a particular swap file in the directory
> /opt/nifi/flowfile_repository/swap. As it turns out the specific file
> existed, however it had a size of 0 bytes. Hence, the error message "Failed
> to read swap file because the file contained less than 4 bytes of data".
> Apart from being empty, the file owner was the user under which Nifi runs.
> Judged from the date of change, the swap file causing this massive log burst
> on the newly elected primary node was written by the affected node itself the
> last time it was primary node before. While this node was not primary node,
> it did not bother the node. However, once it became primary node, the node
> started writing the error message.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)