Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to create an MMKV instance [XXX] in NAPI. #1469

Open
zhinengfeiyu opened this issue Jan 8, 2025 · 6 comments
Open

Fail to create an MMKV instance [XXX] in NAPI. #1469

zhinengfeiyu opened this issue Jan 8, 2025 · 6 comments

Comments

@zhinengfeiyu
Copy link

zhinengfeiyu commented Jan 8, 2025

在HarmonyOS Next系统创建MMKV,偶现会报出如下错误:

Error name:Error
Error message:Fail to create an MMKV instance [XXX] in NAPI.
Stacktrace:
Cannot get SourceMap info, dump raw stack:
at mmkvWithID (xxx|@tencent/mmkv|2.0.1|src/main/ets/utils/MMKV.ts:61:1)
....

创建代码如下:
private mmkv: MMKV
constructor(context: Context, fileName: string) {
this.mmkv = MMKV.mmkvWithID(fileName, MMKV.MULTI_PROCESS_MODE, undefined, context.filesDir + "/mmkv")
}

观察线上崩溃数据,崩溃次数和崩溃设备数大致相等,也就是绝大部分设备只会崩溃一次。崩溃日志也仅能看到上面这些。请问该崩溃产生的可能的原因是什么?

@lingol
Copy link
Collaborator

lingol commented Jan 8, 2025

No idea.

@lingol
Copy link
Collaborator

lingol commented Jan 8, 2025

You should provide logs from MMKV.

@zhinengfeiyu
Copy link
Author

I can only see these logs. How to get more logs from MMKV?

@lingol
Copy link
Collaborator

lingol commented Jan 8, 2025

@lingol
Copy link
Collaborator

lingol commented Jan 9, 2025

I just see the "rootPath" param is "The folder of the MMKV instance, defaults to $(FilesDir)/mmkv",does it mean the param (context.filesDir + "/mmkv") is duplicate for this case?

It's redundant. Follow our official wiki for guidance. https://github.com/Tencent/MMKV/wiki/ohos_setup#setup

@zhinengfeiyu
Copy link
Author

Got it. I will use MMKVHandler to export logs. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants