# Fsync or Swim Part 1: Error Handling

DevFeed: [Fsync or Swim Part 1: Error Handling](<https://devfeed.tech/articles/fsync-or-swim-part-1-error-handling-15662.md>)

Original publisher: [Read original article](<https://developer.squareup.com/blog/fsync-or-swim-part-1-error-handling>)

Author: Square Engineering

Published: 2011-03-17T16:00:00Z

Content type: article

Language: en

Sources: [Square Corner Blog RSS Feed](<https://devfeed.tech/sources/square-corner-blog-rss-feed.md>)

Topics: [Android](<https://devfeed.tech/topics/android.md>), [Filesystems](<https://devfeed.tech/topics/filesystems.md>), [Persistence](<https://devfeed.tech/topics/persistence.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [POSIX](<https://devfeed.tech/topics/posix.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [error-handling](<https://devfeed.tech/tags/error-handling.md>), [errors](<https://devfeed.tech/tags/errors.md>), [filesystems](<https://devfeed.tech/tags/filesystems.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [persistence](<https://devfeed.tech/tags/persistence.md>), [posix](<https://devfeed.tech/tags/posix.md>), [writing](<https://devfeed.tech/tags/writing.md>)

## AI overview

This first article in a series explains why applications must handle fsync errors, particularly on Android. It distinguishes filesystem operation atomicity from durability and describes how library, kernel, and hardware buffers can delay writes. It discusses using FileDescriptor.sync() or FileChannel.force() to explicitly flush data to storage.

## Source excerpt

Heed fsync errors, especially on Android