Open bethebest0622 opened 3 months ago
崩在jsoncpp库里了,这种通常是由于兼容性问题造成的,比如你使用的jsoncpp的头文件和连接的jsoncpp的so文件版本不匹配。
崩在jsoncpp库里了,这种通常是由于兼容性问题造成的,比如你使用的jsoncpp的头文件和连接的jsoncpp的so文件版本不匹配。
如果不匹配 应该是100%崩溃吧,但我现在遇到的情况是,只有1%会崩溃,我怀疑是网络状况不好的情况下,httpresponse的json返回异常,这个您有啥建议吗
看调用堆栈还没到parse那步呢,尝试下升级jsoncpp库
json 嵌套深吗?
void HttpResponseImpl::parseJson() const
{
static std::once_flag once;
static Json::CharReaderBuilder builder;
std::call_once(once, []() {
builder["collectComments"] = false;
builder["stackLimit"] =
static_cast<Json::UInt>(drogon::app().getJsonParserStackLimit());
});
json 嵌套深吗?
void HttpResponseImpl::parseJson() const { static std::once_flag once; static Json::CharReaderBuilder builder; std::call_once(once, []() { builder["collectComments"] = false; builder["stackLimit"] = static_cast<Json::UInt>(drogon::app().getJsonParserStackLimit()); });
不深,非常浅,大多数都是正确的,就是偶尔会集中的报这个问题,所以我怀疑是网络状况不好的时候 出现的
core文件也是 core-EventLoopThread-194672-1718641976 这种
发生崩溃的时候 似乎是一连串的 如图
json 嵌套深吗?
void HttpResponseImpl::parseJson() const { static std::once_flag once; static Json::CharReaderBuilder builder; std::call_once(once, []() { builder["collectComments"] = false; builder["stackLimit"] = static_cast<Json::UInt>(drogon::app().getJsonParserStackLimit()); });
不深,非常浅,大多数都是正确的,就是偶尔会集中的报这个问题,所以我怀疑是网络状况不好的时候 出现的
想法吧 http body 打出来, 看看json 是不是有问题, 再就是 你升级 json cpp 试试吧, 目前这些信息很难定位出问题
json 嵌套深吗?
void HttpResponseImpl::parseJson() const { static std::once_flag once; static Json::CharReaderBuilder builder; std::call_once(once, []() { builder["collectComments"] = false; builder["stackLimit"] = static_cast<Json::UInt>(drogon::app().getJsonParserStackLimit()); });
不深,非常浅,大多数都是正确的,就是偶尔会集中的报这个问题,所以我怀疑是网络状况不好的时候 出现的
想法吧 http body 打出来, 看看json 是不是有问题, 再就是 你升级 json cpp 试试吧, 目前这些信息很难定位出问题
http body 是说没有json解析之前的字节流 打印出来吗? 另外我的jsoncpp是 libjsoncpp.so.1.9.5
stackLimit
对的, bodyPtr_->getString() 这个东西 打出来看看是什么
@an-tao resp->parseJson(); 可以在这添加一个开关来关闭它吗, 每次响应它都会自动解析 json, 这对于不需要使用getJsonObject()的用户似乎是不必要的开销
@an-tao resp->parseJson(); 可以在这添加一个开关来关闭它吗, 每次响应它都会自动解析 json, 这对于不需要使用getJsonObject()的用户似乎是不必要的开销
可以的,你提PR吧,仿照server端处理request的方式,延迟parse
你好,我调用drogon的时候崩溃,崩溃的堆栈信息是:
请问一下,什么情况下会出现这种错误呢,出现之后有啥处理办法可以不crash,感谢