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

多线程调用C++推理库进行OCR推理时出现程序崩溃 #6512

Closed
qiuming-93 opened this issue Jun 7, 2022 · 7 comments
Closed

多线程调用C++推理库进行OCR推理时出现程序崩溃 #6512

qiuming-93 opened this issue Jun 7, 2022 · 7 comments

Comments

@qiuming-93
Copy link

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:Centos
  • 版本号/Version:Paddle_inference:2.1 PaddleOCR: 2.4 cuda:10.1
  • 运行指令/Command Code:
  • 完整报错/Complete Error Message:

多线程调用C++推理库进行OCR推理时出现程序崩溃,堆栈信息如下

#0 0x00007fff8744b04e in ?? () from /usr/lib64/libcuda.so.1
#1 0x00007fff875c4b0f in ?? () from /usr/lib64/libcuda.so.1
#2 0x00007fff874351e0 in ?? () from /usr/lib64/libcuda.so.1
#3 0x00007fff8759ded6 in ?? () from /usr/lib64/libcuda.so.1
#4 0x00007fff87345a1b in ?? () from /usr/lib64/libcuda.so.1
#5 0x00007fff87345c98 in ?? () from /usr/lib64/libcuda.so.1
#6 0x00007fff87345cde in ?? () from /usr/lib64/libcuda.so.1
#7 0x00007fff874cc806 in cuLaunchKernel () from /usr/lib64/libcuda.so.1
#8 0x00007ffc83adca19 in ?? () from ./Algorithm/libs/libcudnn.so
#9 0x00007ffc83adcaa7 in ?? () from ./Algorithm/libs/libcudnn.so
#10 0x00007ffc83b12e9b in ?? () from ./Algorithm/libs/libcudnn.so
#11 0x00007ffc83956d56 in ?? () from ./Algorithm/libs/libcudnn.so
#12 0x00007ffc839696a5 in ?? () from ./Algorithm/libs/libcudnn.so
#13 0x00007ffc838c6a35 in ?? () from ./Algorithm/libs/libcudnn.so
#14 0x00007ffc838c6788 in ?? () from ./Algorithm/libs/libcudnn.so
#15 0x00007ffc8376ecf2 in ?? () from ./Algorithm/libs/libcudnn.so
#16 0x00007ffc837743b0 in ?? () from ./Algorithm/libs/libcudnn.so
#17 0x00007ffc83526342 in ?? () from ./Algorithm/libs/libcudnn.so
#18 0x00007ffc835334a4 in ?? () from ./Algorithm/libs/libcudnn.so
#19 0x00007ffc8355197c in ?? () from ./Algorithm/libs/libcudnn.so
#20 0x00007ffc83555e81 in ?? () from ./Algorithm/libs/libcudnn.so
#21 0x00007ffc83543d20 in ?? () from ./Algorithm/libs/libcudnn.so
#22 0x00007ffc8354477f in cudnnRNNForwardInference () from ./Algorithm/libs/libcudnn.so
#23 0x00007fffb3434509 in paddle::operators::RNNCudnnKernel::Compute(paddle::framework::ExecutionContext const&) const () from ./Algorithm/libs/libpaddle_inference.so
#24 0x00007fffb343df42 in std::_Function_handler<void (paddle::framework::ExecutionContext const&), paddle::framework::OpKernelRegistrarFunctor<paddle::platform::CUDAPlace, false, 0ul, paddle::operators::RNNCudnnKernel, paddle::operators::RNNCudnnKernel >::operator()(char const*, char const*, int) const::{lambda(paddle::framework::ExecutionContext const&)#1}>::_M_invoke(std::_Any_data const&, paddle::framework::ExecutionContext const&) () from ./Algorithm/libs/libpaddle_inference.so
#25 0x00007fffb4681602 in paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&, paddle::framework::RuntimeContext*) const ()
from ./Algorithm/libs/libpaddle_inference.so
#26 0x00007fffb4681d16 in paddle::framework::OperatorWithKernel::RunImpl(paddle::framework::Scope const&, paddle::platform::Place const&) const ()
from ./Algorithm/libs/libpaddle_inference.so
#27 0x00007fffb467ebd8 in paddle::framework::OperatorBase::Run(paddle::framework::Scope const&, paddle::platform::Place const&) () from ./Algorithm/libs/libpaddle_inference.so
#28 0x00007fffafb20890 in paddle::framework::NaiveExecutor::Run() () from ./Algorithm/libs/libpaddle_inference.so
#29 0x00007fffaf80eadb in paddle::AnalysisPredictor::ZeroCopyRun() () from ./Algorithm/libs/libpaddle_inference.so
#30 0x00007ffff21e6353 in PaddleOCR::CRNNRecognizer::Run(std::vector<std::vector<std::vector<int, std::allocator >, std::allocator<std::vector<int, std::allocator > > >, std::allocator<std::vector<std::vector<int, std::allocator >, std::allocator<std::vector<int, std::allocator > > > > >, cv::Mat&, PaddleOCR::Classifier*) ()
from ./Algorithm/libs/libOCR.so
#31 0x00007ffff21dc785 in PaddleOCR::OcrModel::run(cv::Mat&) () from ./Algorithm/libs/libOCR.so

@WenmuZhou
Copy link
Collaborator

使用多进程吧,paddleinference不是线程安全的

@qiuming-93
Copy link
Author

使用多进程吧,paddleinference不是线程安全的

那后续有计划修改成线程安全的嘛

1 similar comment
@qiuming-93
Copy link
Author

使用多进程吧,paddleinference不是线程安全的

那后续有计划修改成线程安全的嘛

@shangzhizhou
Copy link
Member

使用多进程吧,paddleinference不是线程安全的

那后续有计划修改成线程安全的嘛

您好,predictor不是线程安全的。可以使用多线程,只要创建多个predictor,保证每个predictor同一时刻,只在一个线程下处理一个请求即可。

@qiuming-93
Copy link
Author

您好,predictor不是线程安全的。可以使用多线程,只要创建多个predictor,保证每个predictor同一时刻,只在一个线程下处理一个请求即可。

每个线程是单独创建的predictor

@qiuming-93
Copy link
Author

qiuming-93 commented Aug 31, 2022

这个问题还么解决呀,怎么就关了呢,是6514那个issue里面的问题可以通过升级inference到2.3进行解决,这个issue的问题还没解决呢 @WenmuZhou

@leiqing1
Copy link
Collaborator

@qiuming-93 你好 你的问题解决了吗?我是Paddle的PM 雷青。在系统清理多线程多进程问题,如果你的问题还没有解决,麻烦先按照下面的例子尝试下是否能复现问题。如果问题已经存在,可以加我微信(18813190139)一起来看下。
https://github.com/PaddlePaddle/Paddle-Inference-Demo/blob/e9ffb54a86f11aa6d244568ebeb06fa7ad4b7d04/python/advanced/multi_thread/threads_demo.py

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

No branches or pull requests

4 participants