isar / isar/hive

FileSystemException: File closed, path = '/data/user/0/XXXX/app_flutter/_preferencesbox.hive'

Open
#1,217 0 comments 0 reactions 0 assignees View on GitHub
problem
Dominant language
Dart
Stars
4.4k
Forks
449
PR merge metrics
No merged PRs in 30d

Description

**Steps to Reproduce**
when I had got rename error before,hiveBox.get will throw File closed error,because hive had been closed by compact

below is rename error log:
FileSystemException: Cannot rename file to '/data/user/0/com.niocpeed.dna/app_flutter/_preferencesbox.hive', path = '/data/user/0/com.niocpeed.dna/app_flutter/_preferencesbox.hivec' (OS Error: No such file or directory, errno = 2)

as the below picture show,await compactFile.rename(path) should sround with try catch,so it will open hive again

image

**Version**
[✓] Flutter (Channel stable, 3.3.10, on macOS 13.4.1 22F82 darwin-arm, locale zh-Hans-CN)
• Flutter version 3.3.10 on channel stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 135454af32 (6 months ago), 2022-12-15 07:36:55 -0800
• Engine revision 3316dd8728
• Dart version 2.18.6
• DevTools version 2.15.0
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /Users/XXXX/Library/Android/sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment Temurin-11.0.16.1+1 (build 11.0.16.1+1)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.0

[!] Android Studio (version 2022.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
✗ Unable to find bundled Java version.
• Try updating or re-installing Android Studio.

[✓] VS Code (version 1.75.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
• NAM AL00 (mobile) • EMHVB22324002820 • android-arm64 • Android 12 (API 31)
• macOS (desktop) • macos • darwin-arm64 • macOS 13.4.1 22F82 darwin-arm

[✓] HTTP Host Availability
• All required HTTP hosts are available

! Doctor found issues in 1 category.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the compaction path around compactFile.rename(path) and the subsequent hiveBox.get call. Reproduce the failed rename described in the issue and trace how the box is closed afterward. Done means the rename failure is handled without leaving later hiveBox.get calls with a File closed error.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
database, mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.