"Too Many Files" Nexus 5/6棒棒糖上的错误

"Too Many Files" Error On Nexus 5/6 Lollipop

本文关键字:棒棒糖 错误 Too Many Files Nexus      更新时间:2023-10-16

我目前正在使用 cocos2dx-2.2.2 进行游戏项目。

当我做一些操作(从文件中读取纹理并显示对话框)时,应用程序可能会强制关闭或屏幕冻结(尽管网络线程仍在运行)。

它偶尔发生在联结上,但很少发生在其他设备上。

日志如下:

12-29 15:23:01.169: E/Surface(2128): queueBuffer: error queuing buffer to SurfaceTexture, -22
12-29 15:23:01.169: W/Adreno-EGLSUB(2128): <SwapBuffers:1340>: failed to queueBuffer
12-29 15:23:01.169: W/Adreno-EGL(2128): <qeglDrvAPI_eglSwapBuffers:3809>: EGL_BAD_SURFACE
12-29 15:23:01.204: E/Parcel(2128): Parcel::writeDupFileDescriptor failed:
12-29 15:23:01.204: E/Parcel(2128):   fd=1002 flags=0 err=0(Success)
12-29 15:23:01.204: E/Parcel(2128):   dupFd=-1 dupErr=24(Too many open files) flags=-1 err=9(Bad file number)
12-29 15:23:01.204: E/Parcel(175): dup failed in Parcel::read, fd 0 of 1
12-29 15:23:01.204: E/Parcel(175):   dup(-2147483647) = -1 [errno: 9 (Bad file number)]
12-29 15:23:01.204: E/Parcel(175):   fcntl(-2147483647, F_GETFD) = -1 [errno: 9 (Bad file number)]
12-29 15:23:01.204: E/Parcel(175):   flat 0x0 type 0
12-29 15:23:01.216: D/Parcel(175): #00 pc 0000cff1  /system/lib/libutils.so (android::CallStack::update(int, int)+52)
12-29 15:23:01.216: D/Parcel(175): #01 pc 0000d107  /system/lib/libutils.so (android::CallStack::CallStack(char const*, int)+38)
12-29 15:23:01.216: D/Parcel(175): #02 pc 00023513  /system/lib/libbinder.so (android::Parcel::read(android::Parcel::FlattenableHelperInterface&) const+246)
12-29 15:23:01.216: D/Parcel(175): #03 pc 00033035  /system/lib/libgui.so (android::BnGraphicBufferProducer::onTransact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+568)
12-29 15:23:01.216: D/Parcel(175): #04 pc 0001a6d9  /system/lib/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+60)
12-29 15:23:01.216: D/Parcel(175): #05 pc 0001f787  /system/lib/libbinder.so (android::IPCThreadState::executeCommand(int)+582)
12-29 15:23:01.216: D/Parcel(175): #06 pc 0001f8ab  /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+38)
12-29 15:23:01.216: D/Parcel(175): #07 pc 0001f8ed  /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
12-29 15:23:01.216: D/Parcel(175): #08 pc 00023a5b  /system/lib/libbinder.so
12-29 15:23:01.216: D/Parcel(175): #09 pc 000104d5  /system/lib/libutils.so (android::Thread::_threadLoop(void*)+112)
12-29 15:23:01.216: D/Parcel(175): #10 pc 00010045  /system/lib/libutils.so
12-29 15:23:01.216: D/Parcel(175): #11 pc 000162e3  /system/lib/libc.so (__pthread_start(void*)+30)
12-29 15:23:01.216: D/Parcel(175): #12 pc 000142d3  /system/lib/libc.so (__start_thread+6)

任何想法可能出错?

这看起来与我遇到的错误非常相似。我的不是特定于nexus的(尽管我在Nexus 9上修复了它)。您是否正确关闭了要打开的FD?那是我的问题。

在我的特定场景中:1)我正在打开OpenSL的音频文件:

AAssetManager_open

2) 获得 FD

AAsset_openFileDescriptor

3) 在 AA 集合上调用AAsset_close,并使用 FD。

问题是没有相应的AAsset_closeFileDescriptor,也没有提到关闭FD。当我最初编写代码时,我认为这很奇怪,但假设这是由后来的方法处理的。然而,我的直觉是对的,它所做的只是在我播放音频文件时打开越来越多的 FD,但在达到内部限制之前从未释放它们。

我使用的修复程序是调用:

close(fd);

当我完成FD时。你可以找到附近的

#include <fcntl.h>