[CXX-550]  the exception in the mongo-cxx-driver Created: 04/Mar/15  Updated: 06/Mar/15  Resolved: 06/Mar/15

Status: Closed
Project: C++ Driver
Component/s: API, Release
Affects Version/s: legacy-1.0.0-rc1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Fly.ang Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: driver, exception, legacy-cxx, query
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: JPEG File mongoDBServer.jpg     File {2551D4CB-1AAC-4F92-8A48-B7F2D5FFDBD3}.bmp    

 Description   

The application is used the driver to connect the MongoDB Server. It will failed and throw exception on sometime. I catch the exception, but the next request is failed.
Look the cmd of the MongoDB Server. It is normal. But I forget added the log flags when run the MongoDB Server.
So I only Provide the image of the application runned.
MongoDB : win32-i386-2.6.5
Client : win7 x64



 Comments   
Comment by Andrew Morrow (Inactive) [ 06/Mar/15 ]

Hi chen610620 -

You are correct: the Connection object is not thread safe, by design. The correct way to manage this is to either give every thread a thread-local connection object, or to write a thread-safe pool of connections, and have threads request and return connections from the pool. Which strategy is best depends heavily on the design of the application.

I'm going to close this issue, please feel free to re-open it if you require additional help with this issue.

Thanks,
Andrew

Comment by Fly.ang [ 06/Mar/15 ]

Thanks all.
I find the reason. It because the multi-thread. The Connection is not safe in multi-thread.So I used the mutex.
Is there a better solution? I want to have better performance, if can.

Comment by Tyler Brock [ 04/Mar/15 ]

Thank you for reporting the issue.

Would it be possible to upgrade the driver to legacy-1.0.0-stable? Is it possible to share the code that is throwing the exception? It is likely that the driver will throw errors which are not shown on the server (for example when it cannot connect or is disconnected – there is a socket exception).

Any additional information you could give us about the code in the application (possibly in the form of a small reproducible example or succinct explanation if you cannot provide the code iteself) would help.

-Tyler

Generated at Wed Feb 07 21:59:32 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.