解决SSH免密登录配置成功后不生效问题

配置 ssh 通过秘钥登录时,已经将公钥成功写入服务器的 ~/.ssh/authorized_keys 中,但是在自己这边一直连不上.
解决SSH免密登录配置成功后不生效问题.
因为 sshd 服务对用户的 home.ssh 目录有权限限制,需要修改这两个目录和authorized_keys的属主组权限.

local reference table overflow (max=512)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
JNI ERROR (app bug): local reference table overflow (max=512)                                                
local reference table dump:
Last 10 entries (of 512):
511: 0x12e38800 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
510: 0x12e387e0 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
509: 0x12e387c0 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
508: 0x12e387a0 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
507: 0x12e38740 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
506: 0x12e38720 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
505: 0x12e38700 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
504: 0x12e386e0 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
503: 0x12e386c0 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
502: 0x12e38680 com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint
Summary:
502 of com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint (502 unique instances)
8 of com.liulishuo.engzo.bell.business.ai.detect.FaceKeyPoint[] (68 elements) (8 unique instances)
1 of java.lang.Class
1 of java.lang.Thread

在Android中局部引用表默认最大容量是 512 个

  • 记住删除局部引用
1
2
3
4
5
6
7
8
9
10
11
12
 for (int i = 0; i < FACE_KEY_POINT_COUNT; ++i) {
Point point = output.face_shape.points[i];
jobject javaPoint = env->NewObject(pointClass, pointConstructor, point.x, point.y);
if (env->ExceptionCheck()) {
env->ExceptionDescribe();
env->ExceptionClear();
return nullptr;
}
env->SetObjectArrayElement(points, i, javaPoint);
// 添加这一行,删除本地引用
env->DeleteLocalRef(javaPoint);
}
  • 缓存 jclass

在 init 时使用 GlobalRef 存储会用到的 jclass,避免每次都调用 FindClass

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
static jclass g_cls_DetectResult = NULL;
static jclass g_cls_LandMarkPoint = NULL;
static jclass g_cls_MouthShapeOutPut = NULL;

initLib(JNIEnv *env, jclass clasz) {

jclass detectClass = env->FindClass(Face_Detect_Result_JAVA_ClASS);
g_cls_DetectResult = static_cast<jclass>(env->NewGlobalRef(detectClass));
env->DeleteLocalRef(detectClass);

jclass landMarkClass = env->FindClass(LandMark_Point_JAVA_CLASS);
g_cls_LandMarkPoint = static_cast<jclass>(env->NewGlobalRef(landMarkClass));
env->DeleteLocalRef(landMarkClass);

jclass mouthClass = env->FindClass(MouthShapeOutput_JAVA_CLASS);
g_cls_MouthShapeOutPut = static_cast<jclass>(env->NewGlobalRef(mouthClass));
env->DeleteLocalRef(mouthClass);
}

反解 proto buf 的二进制文件

有对应的 proto 文件

1
protoc --decode [message_name] [.proto_file_path] < [binary_file_path] >> output_path
  • [message_name] 是.proto文件中消息对象的名称。如果消息位于.proto文件中的包中,请使用package_name.message_name.
  • [.proto_file_path]是定义消息的.proto文件的路径。
  • [binary_file_path]是要解码的文件的路径。
  • [output_path]输出到文件

没有对应的 proto 文件

1
protoc --decode_raw < [binary_file_path] >> output_path