gpt4 book ai didi

android - 由于错误 -24,无法分配大小为 2097152 的 CursorWindow '/pos-db'

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:11:45 25 4
gpt4 key购买 nike

异常信息

cannot open file at line 30176 of [00bb9c9ce4]
(14) os_unix.c:30176: (24) open(/data/data/c/databases/pos-db-journal) -
(14) cannot open file at line 30176 of [00bb9c9ce4]
(14) os_unix.c:30176: (24) open(/data/data/c/pos-db-journal) -
(14) statement aborts at 14: [SELECT T."_id",T."PRINTDATA",T."POSITION",T."DOUBLEFORMAT",
T."PRINTERMODE",T."INSERTTIME" FROM "PRINT_DATA_ITEM" T] unable to open database file
E/SQLiteQuery: exception: unable to open database file (code 14); query: SELECT T."_id",T.
"PRINTDATA",T."POSITION",T."DOUBLEFORMAT",T."PRINTERMODE",T."INSERTTIME" FROM "PRINT_DATA_ITEM" T

部分代码:

 private PrinterTask(Context context) {
this.mContext = context;
helper = new DaoMaster.DevOpenHelper(context, "pos-db", null);
db = helper.getWritableDatabase();
mDaoMaster = new DaoMaster(db);
mDaoSession = mDaoMaster.newSession();
mPrintDataItemDao = mDaoSession.getPrintDataItemDao();
mRequestDataItemDao = mDaoSession.getRequestDataItemDao();
}
//
public void startPrintThread() {
dataIsExist = true;
//
if (!threadIsRuning) {
thread = new Thread() {
@Override
public void run() {
super.run();
threadIsRuning = true;
List<PrintDataItem> list;
while (dataIsExist) {
list = mPrintDataItemDao.loadAll();
if (list != null && list.size() > 0) {
KLog.d("startPrintThread", String.valueOf(++count) + " " + String.valueOf(list.size()));
}
threadIsRuning = false;
}
};
thread.start();
}

当计数增加到大约 600000 时,app 将无任何征兆地存在。然后 logcat 输出这些信息。

日志输出:

(1)Could not create epoll instance. errno=24
(2)CursorWindow(26673): Could not allocate CursorWindow of size 2097152 due to error -24
(3)F/Looper (26673): Could not create wake pipe. errno=24
I/qtaguid (20825): Failed write_ctrl(s 0 10051) res=-1 errno=1
FATAL EXCEPTION: Thread-118`enter code here`

我该怎么做才能解决这个问题?我会感激的!

最佳答案

这些代码没问题。我发现其他代码加载这些异常。我使用 intentservice 和 AlarmManager 进行循环服务。我放弃了 AlarmManager。然后像这样更改代码:有用。异常不再出现。

new Thread(new Runnable() {
@Override
public void run() {
mRequestDataItem = DBHelper.getInstance(getApplicationContext()).getTopFailedNetRequestInDataBase();
while (isRunning) {
CommonUtilLog.d("reRequestTask Loop", String.valueOf(countLoop++));
if (!isPosting) {
if (reRequestTask == null) {
if (mRequestDataItem != null) {
CommonUtilLog.d("reRequestTask", String.valueOf(count++));
reRequestTask = new ReRequestTask(mRequestDataItem);
}
}
}
try {
Thread.sleep(CommonConstant.THREAD_SLEEP_RETRY_REQUEST_SERVICE);
} catch (InterruptedException e) {
e.printStackTrace();
}
mRequestDataItem = DBHelper.getInstance(getApplicationContext()).getTopFailedNetRequestInDataBase();
}
}
}).start();

发现问题的方法:来自这篇博客的博主:http://ju.outofmemory.cn/entry/247095“差错”,逐步注解代码,找出出错的真凶。

关于android - 由于错误 -24,无法分配大小为 2097152 的 CursorWindow '/pos-db',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36300821/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com