This question looks the same as β Failed to read input channel file descriptors from a section that was (incorrectly) closed off topic. It is also more or less the same as Failed to read input channel file descriptors from the report Unfortunately, these questions did not receive a satisfactory (and fairly general) answer, so Iβll try anyway.
File descriptors are used in several places in Android:
- Sockets (yes, open network connections are also βfilesβ);
- Actual files (not necessarily files on disks, can also be instances of
android.os.MemoryFile ); - Channels - Linux uses them everywhere, for example, trying to open a channel that led to your exception was probably required to send input events between the IME process (keyboard) and your application.
All descriptors obey the general maximum limit ; when this number is exceeded, your application begins to experience serious problems. In this case, the best scenario is to use the die process, because otherwise the kernel would run out of memory (file descriptors are stored in kernel memory).
You may have problems closing the descriptors (files, network connections). You should close them as soon as possible. You may also have problems with memory leaks - objects are not garbage collected when they should (and some of the leaks may, in turn, contain file descriptors).
Your own code should not be guilty, the libraries that you use, and even some system components, may have errors leading to memory leaks and file descriptor leaks. I recommend that you use Square Leak Canary , a simple and convenient library for automatically detecting leaks (well, at least the memory leaks that are most common).
source share