Skip to content

TensorRT crashes on Windows unless it is the first imported module #2853

Closed
@mantaionut

Description

@mantaionut

Description

The exception mechanism in pybind11 causes a crash in TensorRT if its not the first module imported.
If another module throws an exception than it will cause tensorRT to crash.
This issue seems similar to this one onnx/onnx#3493 but I was not able to build TensorRT with debug symbols so I can't be sure.

 	tensorrt.cp39-win_amd64.pyd!00007ffca92426a0()	Unknown
 	tensorrt.cp39-win_amd64.pyd!00007ffca92428a5()	Unknown
 	tensorrt.cp39-win_amd64.pyd!00007ffca913bf49()	Unknown
 	tensorrt.cp39-win_amd64.pyd!00007ffca9148fe7()	Unknown
 	tensorrt.cp39-win_amd64.pyd!00007ffca9149ad6()	Unknown
 	python_example.cp39-win_amd64.pyd!00007ffce8d063b8()	Unknown
 	python_example.cp39-win_amd64.pyd!00007ffce8d132f9()	Unknown
 	vcruntime140_1.dll!00007ffd4b281080()	Unknown
 	vcruntime140_1.dll!00007ffd4b2826f5()	Unknown
 	ntdll.dll!RcConsolidateFrames�()	Unknown
 	python_example.cp39-win_amd64.pyd!00007ffce8d08fda()	Unknown
 	[External Code]	
>	PythonApplication1.py!<module> Line 3	Python

Environment

TensorRT Version: TensorRT-8.6.0.12
NVIDIA GPU: RTX 3060 Laptop GPU
NVIDIA Driver Version: 526.56
CUDA Version: 11.8
CUDNN Version: 8.5.0
Operating System: Windows 11
Python Version (if applicable): 3.9
Tensorflow Version (if applicable):
PyTorch Version (if applicable): 2.0
Baremetal or Container (if so, version):

Relevant Files

Steps To Reproduce

2 modules have this issues with TensorRT. One is torch, but I also created a small module https://github.com/mantaionut/python_example that has the same issue.
repro 1:

import torch
import tensorrt

graph = torch._C.Graph()
graph.addInput()

for i in graph.inputs():
    print(i)

print('finish')

repro 2:
git clone https://github.com/mantaionut/python_example
cd python_example
pip install .

import python_example
import tensorrt
python_example.add(3,5)
print('finish')

Metadata

Metadata

Assignees

Labels

internal-bug-trackedTracked internally, will be fixed in a future release.triagedIssue has been triaged by maintainers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions