PaddlePaddle / Paddle

PArallel Distributed Deep LEarning: Machine Learning Framework from Industrial Practice (『飞桨』核心框架,深度学习&机器学习高性能单机、分布式训练和跨平台部署)
http://www.paddlepaddle.org/
Apache License 2.0
22.26k stars 5.59k forks source link

Segmentation fault in `paddle.multiplex`. #64117

Open Zoeeeeey opened 6 months ago

Zoeeeeey commented 6 months ago

bug描述 Describe the Bug

您好,以下是我的报告内容。 paddle.multiplex缺少对输入参数inputs的深入类型判断。

当输入的inputs为list,但列表元素不是多维Tensor时,空指针导致程序进程崩溃,出现Segmentation fault (core dumped)。

这段简单的代码可以复现这个错误。

import paddle

img1 = [[1, 2], [3, 4]]
img2 = [[5, 6], [7, 8]]
inputs = [img1, img2]
index = paddle.to_tensor([[1], [1]], dtype=paddle.int32)
res = paddle.multiplex(inputs, index)
print(res)

报错信息:

WARNING: OMP_NUM_THREADS set to 12, not 1. The computation speed will not be optimized if you use data parallel. It will fail if this PaddlePaddle binary is compiled with OpenBlas since OpenBlas does not support multi-threads.
PLEASE USE OMP_NUM_THREADS WISELY.
--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
0   paddle::pybind::eager_api_multiplex(_object*, _object*, _object*)
1   paddle::pybind::GetTensorListFromArgs(std::string const&, std::string const&, _object*, long, bool, phi::distributed::ProcessMesh const*)
2   phi::TypeInfoTraits<phi::TensorBase, phi::distributed::DistTensor>::classof(phi::TensorBase const*)
----------------------
Error Message Summary:
----------------------
FatalError: `Segmentation fault` is detected by the operating system.
  [TimeInfo: *** Aborted at 1714811988 (unix time) try "date -d @1714811988" if you are using GNU date ***]
  [SignalInfo: *** SIGSEGV (@0xa) received by PID 30576 (TID 0x7fa958823280) from PID 10 ***]

Segmentation fault (core dumped)

其他补充信息 Additional Supplementary Information

版本:paddlepaddle 2.6 (cpu)

minghaoBD commented 6 months ago

好的,谢谢反馈。我们内部看一下

Zoeeeeey commented 6 months ago

您好,这是我补充的测试用例:

import paddle

inputs=[0.4182267863762318, 0.5395831069848569, 0.39240171609240226]
index=paddle.randint(low=0, high=100, shape=(2,), dtype=paddle.int32)
paddle.multiplex(inputs=inputs,index=index)

输出内容:

--------------------------------------
C++ Traceback (most recent call last):
--------------------------------------
0   paddle::pybind::eager_api_multiplex(_object*, _object*, _object*)
1   paddle::pybind::GetTensorListFromArgs(std::string const&, std::string const&, _object*, long, bool, phi::distributed::ProcessMesh const*)
2   phi::TypeInfoTraits<phi::TensorBase, phi::distributed::DistTensor>::classof(phi::TensorBase const*)

----------------------
Error Message Summary:
----------------------
FatalError: `Segmentation fault` is detected by the operating system.
  [TimeInfo: *** Aborted at 1715238912 (unix time) try "date -d @1715238912" if you are using GNU date ***]
  [SignalInfo: *** SIGSEGV (@0x0) received by PID 527163 (TID 0x7f3943c9a280) from PID 0 ***]

Segmentation fault (core dumped)