打开失败:EBUSY(设备或资源忙) [英] open failed: EBUSY (Device or resource busy)

查看:2193
本文介绍了打开失败:EBUSY(设备或资源忙)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序一个奇怪的错误。

I have a strange error in my App.

在我的应用程序,可以下载一个压缩文件,读取内容,它是什么,并删除它。它的问题不在于究竟是。

In my app it is possible to download a zipFile, read the content as what it is and also delete it. Its doesn't matter what exactly it is.

问题:只有在摩托罗拉Xoom(版本4.0.4)我可以下载该文件,将它解压缩,我可以读取数据,我可以删除一切。 但是,如果我尝试再次下载该文件,虽然它解压缩文件,将文件复制到SD卡用错误EBUSY(设备或资源忙)。崩溃

Problem: Only on the Motorola Xoom (version 4.0.4) I can download the file, unzip it, I can read the data and I can delete everything. But if I try to Download the file again and while it unzip the file and copy the files to SD-Card it crashes with the error EBUSY (Device or resource busy).

  1. 为什么它的工作仅在第一次?
  2. 什么是指错误?
  3. 为什么我得到这个错误只在Xoom的?

我找不到任何解决办法。在所有其它设备工作正常,没有任何错误或问题。

I can't find any solution for that. On all other devices it works fine, no errors or problems.

LogCat中:

07-18 12:27:46.774: E/PrepareMagTask(10057): IOException
07-18 12:27:46.774: E/PrepareMagTask(10057): java.io.FileNotFoundException: /mnt/sdcard/Android/data/com.xxxxxx.android/files/content/23760/emag.db: open failed: EBUSY (Device or resource busy)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at libcore.io.IoBridge.open(IoBridge.java:406)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at java.io.FileOutputStream.<init>(FileOutputStream.java:88)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at java.io.FileOutputStream.<init>(FileOutputStream.java:73)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at com.xxxxx.android.util.io.ZipHelper.uncompressEntry(ZipHelper.java:35)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at com.xxxxx.android.task.PrepareMagTask.doInBackground(PrepareMagTask.java:271)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at com.xxxxx.android.task.PrepareMagTask.doInBackground(PrepareMagTask.java:1)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at android.os.AsyncTask$2.call(AsyncTask.java:264)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at java.lang.Thread.run(Thread.java:856)
07-18 12:27:46.774: E/PrepareMagTask(10057): Caused by: libcore.io.ErrnoException: open failed: EBUSY (Device or resource busy)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at libcore.io.Posix.open(Native Method)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at libcore.io.BlockGuardOs.open(BlockGuardOs.java:110)
07-18 12:27:46.774: E/PrepareMagTask(10057):    at libcore.io.IoBridge.open(IoBridge.java:390)
07-18 12:27:46.774: E/PrepareMagTask(10057):    ... 11 more

它崩溃的第35行中我ZipHelper类:

It crashes at line 35 in my ZipHelper class:

FileHelper.copy(zipFile.getInputStream(entry), new FileOutputStream(outputFile), modify);

的getInputStream(入门)......我真的不知道为什么?

getInputStream(entry) ... and I really dont know why?

时那里等待设备或追索的方法,当它是忙吗? 这是每一次我尝试解压文件发生了,应用程序会尝试这5时(下载 - >解压缩),它崩溃每次。

Is there a method to wait for the device or recourse, when it is busy? This is happened every time I try to unzip the file, the app tries it 5 time (Downloading -> Unzip) and it crashes every time.

编辑:我们发现,其不但Xoom的。我们也有与华硕Transformer中的错误与版本4.0.4

We found out, its not only the Xoom. We also have the error with the Asus Transformer with the version 4.0.4

推荐答案

我有很大的答案! 问题就来了从Android系统或/和FAT32系统。 我无法解释系统是如何得到的错误,它是与删除文件和FAT32系统。

I have the big Answer!! The Problem comes from the Android System or / and the FAT32 system. I can not explain how the system get the error, it has something to do with deleting files and the FAT32 System.

不过,该解决方案是非常简单: 在删除一个目录或文件:重命名为

But the solution is really easy: Before you delete a Directory or File: rename it!

code重命名:

final File to = new File(file.getAbsolutePath() + System.currentTimeMillis());
file.renameTo(to);
to.delete();

这就是它,如果重命名文件夹或删除之前的文件,也没有机会系统再次尝试打开现有的文件或打开文件至极要再次保存(或像这样)。

Thats it, if you rename the folder or file before you delete it, there is no chance for the system to try to open an existing file again or an open file wich you want to save again (or something like this).

这篇关于打开失败:EBUSY(设备或资源忙)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆