question

83438364 avatar image
0 Votes"
83438364 asked 83438364 commented

MFC project used to access mysql database crashed

I use multiple threads to access the MySQL database through ado. The work of each thread is: just connect to the database and then disconnect, and then end. But every time after running for a long time, the program crashes, and the crashing interface is as follow.

110037-%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE290.png
figure 1

the function showing in the figure 2 is used in the thread:
110045-%E5%B1%8F%E5%B9%95%E6%88%AA%E5%9B%BE317.png
figure 2




c++dotnet-adonet
屏幕截图290.png (184.8 KiB)
屏幕截图317.png (73.4 KiB)
· 11
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.


Maybe you should send a sample Visual Studio project to https://bugs.mysql.com/bug.php?id=103968 or somehow emphasize the reported issue.


0 Votes 0 ·

Hi ,Viorel-1
I have sent a a sample Visual Studio project to https://bugs.mysql.com/bug.php?id=103968 which can reproduce the issue.If you cannot download the project,please tell me.


0 Votes 0 ·

Hi ,Viorel-1
I have sent a a sample Visual Studio project to https://bugs.mysql.com/bug.php?id=103968 which can reproduce the issue.If you cannot download the project,please tell me.


0 Votes 0 ·

Hello,Viorel-1
If you cannot download this sample project,please try this onedrive link
https://1drv.ms/u/s!AlRuioLOk-Tng2QeKchxa_uVHrbr?e=6YXphv

0 Votes 0 ·

@83438364

Could you please provide a sample by code instead of picture to help us reproduce the issue?

Typically, the COM library is initialized on a thread only once. CoInitialize/CoUninitialize are meant to be run once on startup and once on shutdown of the application.

I suggest you could try to check whether the first thread in the application that calls CoInitialize with 0 (or CoInitializeEx with COINIT_APARTMENTTHREADED) must be the last thread to call CoUninitialize. Otherwise, subsequent calls to CoInitialize on the STA will fail and the application will not work.


0 Votes 0 ·

Hi, JeanineZhang-MSFT
II have provided a sample project on https://bugs.mysql.com/bug.php?id=103968`enter code here`,in the case of the zip file cannot be uploaded here.


0 Votes 0 ·

Hi ,JeanineZhang-MSFT
I have sent a a sample Visual Studio project to https://bugs.mysql.com/bug.php?id=103968 which can reproduce the issue.If you cannot download the project,please tell me.


0 Votes 0 ·

@83438364

I suggest you could try to share the code directly to Onedrive.

0 Votes 0 ·
Show more comments

0 Answers