Assigned
Status Update
Comments
js...@android.com <js...@android.com> #2
This issue does not reproduce with dev preview 4.
bi...@gmail.com <bi...@gmail.com> #3
Closing this issue as per comment #2 from reporter.
bi...@gmail.com <bi...@gmail.com> #4
I have reproduced the issue on both:
- Jellybean/Android 4.1.2 running on Samsung Galaxy Nexus, and
- Gingerbread/Android 2.3.4 running on Motorola Droid2
- Jellybean/Android 4.1.2 running on Samsung Galaxy Nexus, and
- Gingerbread/Android 2.3.4 running on Motorola Droid2
mm...@commonsware.com <mm...@commonsware.com> #6
I too can reproduce this problem on a Galaxy Nexus running Android 4.1. Attached are a pair of projects that demonstrate it.
The two projects are identical except for package name and LogCat tags. To see the problem in action, run OpenLotsaFiles, which will open 600 files on external storage, then sleep for 1 minute. During the sleep period, run OpenLotsaFiles2, which will also try to open 600 files on external storage. This one will crash at ~400, depending on what else is running on the device and happens to have open file descriptors on external storage at the time.
The two projects are identical except for package name and LogCat tags. To see the problem in action, run OpenLotsaFiles, which will open 600 files on external storage, then sleep for 1 minute. During the sleep period, run OpenLotsaFiles2, which will also try to open 600 files on external storage. This one will crash at ~400, depending on what else is running on the device and happens to have open file descriptors on external storage at the time.
al...@gmail.com <al...@gmail.com> #7
Just checked on Galaxy S3 and Nexus7 running ICS and I can confirm the projects do reproduce my original problem. Great job! thanks
ki...@yahoo.com <ki...@yahoo.com> #8
It's surprising (to me at least) that this problem can occur in android 4.1. Does this new app succeed running on anything else? What else did you tested other than nexus and galaxy s3 (and the ones that were mentioned here?)
mm...@commonsware.com <mm...@commonsware.com> #9
@8: Affected hardware should show FUSE (e.g., /dev/fuse) as being the mount point for external storage (e.g., /mnd/sdcard) and will show "nofiles(descriptors)" set to 1024 as the output of `ulimit -a`. So, for example, the Galaxy Nexus and the RAZR i have these values; the Nexus S and HTC One S do not.
st...@gmail.com <st...@gmail.com> #10
Sorry if this sounds so novice, but did you not check if the app is the one that create the emfile error instead of focusing on the sd card file descriptors limit??
be...@gmail.com <be...@gmail.com> #11
@10: From what I understand here, the app is not the problem. If it is, the AVD would point it out. This problem is due to the SD card. Interesting problem, checking out this particular process at the moment:
/system/bin/sdcard (/data/media/*).
/system/bin/sdcard (/data/media/*).
al...@gmail.com <al...@gmail.com> #12
I can confirm this problem also exists on ASUS Transformer Pad TF700T device.
mr...@gmail.com <mr...@gmail.com> #13
This process
/system/bin/sdcard (/data/media/*)
also eats up cpu time!
/system/bin/sdcard (/data/media/*)
also eats up cpu time!
ca...@gmail.com <ca...@gmail.com> #14
Exactly how many open files the app demand at one time? It is possible for there to be quite a few processes running simultaneously and if most of them have many open external storage files, of course the emfile error is triggered?
al...@gmail.com <al...@gmail.com> #15
It is very unlikely for one app to open 1024 files simultaneously. But the problem is that this limit is for all apps on the device. Imagine yourself a device with 50 apps running concurrently, all asking to open 20 files at the same time = 1000 open file descriptors.
ga...@gmail.com <ga...@gmail.com> #16
@comment 14&15:
I think that was what caihafe meant (he pointed out the situation in comment 15), most processes/apps these days demand large openfiles, so demand openfiles + the numbers of apps running -> emfile error.
Unless of course, you try to run the app that you're working on ALONE on SD, meaning get rid any unnecessary/other apps, and test the app again. Did you already do this?
But the suggestion to limit the app openfile demand might undermine the quality of the app being develop. Just my two cents.
I think that was what caihafe meant (he pointed out the situation in comment 15), most processes/apps these days demand large openfiles, so demand openfiles + the numbers of apps running -> emfile error.
Unless of course, you try to run the app that you're working on ALONE on SD, meaning get rid any unnecessary/other apps, and test the app again. Did you already do this?
But the suggestion to limit the app openfile demand might undermine the quality of the app being develop. Just my two cents.
ca...@gmail.com <ca...@gmail.com> #17
>>comment16
If developers have to adjust their apps accordingly to the 1023 files descriptors, to not 'trigger' the emfile error, then we might as well quit developing new apps for android.
If developers have to adjust their apps accordingly to the 1023 files descriptors, to not 'trigger' the emfile error, then we might as well quit developing new apps for android.
al...@gmail.com <al...@gmail.com> #18
@comment 16:
Oh, you're right, I misunderstood caihafe's comment. my bad :)
Oh, you're right, I misunderstood caihafe's comment. my bad :)
ve...@gmail.com <ve...@gmail.com> #19
I think this bug related to my problem? I implemented a file cache to load small images for a long grid view. After scrolling a while, I get a lot of:
libcore.io.ErrnoException: open failed: EMFILE (Too many open files)
libcore.io.ErrnoException: open failed: EMFILE (Too many open files)
al...@gmail.com <al...@gmail.com> #20
@19: does it happen with internal SD devices only? (Galaxy S3 / Nexus 7 / Galaxy Nexus)
ve...@gmail.com <ve...@gmail.com> #21
@20: So far I only tried it on Galaxy Nexus android 4.1.
al...@gmail.com <al...@gmail.com> #22
@21: Try it on an AVD emulator or an old device with an external sd card. If the error does not happen then maybe it has to do with this problem.
ve...@gmail.com <ve...@gmail.com> #23
@22: Ok, I'll try check it on AVD or Nexus S. By the way, this is the code I tried to read one bitmap.
File fullCacheDir = new File(Environment.getExternalStorageDirectory().toString(), cacheDir);
File file = new File(fullCacheDir.toString(), fileName);
if (!file.exists()) {
return null;
}
Bitmap bm = BitmapFactory.decodeFile(file.toString());
File fullCacheDir = new File(Environment.getExternalStorageDirectory().toString(), cacheDir);
File file = new File(fullCacheDir.toString(), fileName);
if (!file.exists()) {
return null;
}
Bitmap bm = BitmapFactory.decodeFile(file.toString());
ty...@gmail.com <ty...@gmail.com> #24
@comment 23:
veasing, I see nothing wrong with your coding (unless someone else has other opinions). Not sure if you already tried what alik.hoc suggested, but I definitely think the problem lies with the sd card.
veasing, I see nothing wrong with your coding (unless someone else has other opinions). Not sure if you already tried what alik.hoc suggested, but I definitely think the problem lies with the sd card.
ka...@gmail.com <ka...@gmail.com> #25
I have a lgmotion ms770 ...just updated ota lgfotaclient.apj to change softwear to ms77010d.
I am having emfile error, force closes. Vanishing media ( stored on internal sd.)
I also have 2g ext sd
My lg quickmemo wont work
Files renamed (image) .png
Unacessable...used to be in gallery
Now not.
Shown locked in /mnt/sdcard/DCIM
not readable ...cant copy.
If click folder properties change to 0
I am having emfile error, force closes. Vanishing media ( stored on internal sd.)
I also have 2g ext sd
My lg quickmemo wont work
Files renamed (image) .png
Unacessable...used to be in gallery
Now not.
Shown locked in /mnt/sdcard/DCIM
not readable ...cant copy.
If click folder properties change to 0
do...@gmail.com <do...@gmail.com> #26
The SD card need to be fixed!
ma...@gmail.com <ma...@gmail.com> #27
I have had problem like kalizmo before, the same culprit:
/mnt/sdcard/DCIM
/mnt/sdcard/DCIM
an...@gmail.com <an...@gmail.com> #28
The SD limitation needs to be fixed quick. It wont be able to handle the number of apps nowadays that have large openfile demands.
mi...@gmail.com <mi...@gmail.com> #29
I think every new developed apps going to to trigger the emfile error because of the SD limitation.
kh...@gmail.com <kh...@gmail.com> #30
[Comment deleted]
kh...@gmail.com <kh...@gmail.com> #31
The hard limit to the number of open files per process can be configured with system level access, but not through Android. No choice but to write your app so fewer files are open at once.
lo...@yahoo.com <lo...@yahoo.com> #32
Same problems Asus Infinity .. just started with latest update and now the battery dies, it gets hot and can't run anything cpu intensive anymore. The main process eating t he cpu up is /system/sbin/sdcard. I cleaned out a crap load of apps as well, to try and find the issue but it seems to be OS related.
li...@gmail.com <li...@gmail.com> #33
On my Galaxy Nexus the sdcard process gets stuck in a loop for about a day, heating up the unit and draining the battery within a couple hours.
PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
133 1 media_rw R 3592 0.5 1 45.5 /system/bin/sdcard /data/media 1023 1023
Model I9250 running 4.1.1. Not sure what triggers it yet but it happens at least once a month.
PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
133 1 media_rw R 3592 0.5 1 45.5 /system/bin/sdcard /data/media 1023 1023
Model I9250 running 4.1.1. Not sure what triggers it yet but it happens at least once a month.
jb...@android.com <jb...@android.com> #34
[Comment deleted]
jb...@android.com <jb...@android.com> #35
[Comment deleted]
jb...@android.com <jb...@android.com> #36
[Comment deleted]
Description
It works well on an AVD emulator but encounters problems on real devices with internal SD cards.
In certain circumstances, it receives the EMFILE (Too many open files) error while trying to open some of the image files. I've noticed that this happens more frequently on devices which have an antivirus application installed as well.
The difference between the AVD emulator and a device with an internal SD card (like the Galaxy SIII or Samsung Galaxy) is that the sdcard is implemented as a fuse filesystem in the latter one.
This is the mount output of "/mnt/sdcard" on a Galaxy Nexus device:
/dev/fuse /mnt/sdcard fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
After investigation, I found out that all the files opened by applications on the fuse filesystem (/mnt/sdcard/*) are actually opened by a process called /system/bin/sdcard (/data/media/*).
Once this process opens 1024 files, it reaches the too many open files.
Just to clarify, the entire device is limited to 1024 files descriptors.
This has nothing to do with the max files defined for the device (/proc/sys/fs/file-max).
I find this as a very serious limitation for all internal SD devices.
I'd be happy to supply more info if needed.
Best regards,
Alik