Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2012
    Posts
    3

    Question Unanswered: DB2Connection & AbandonedMutexException

    Hi guys,
    In my .Net application opened DB2Connection raises AbandonedMutexException when I try to execute DB2Command.ExecuteReader()
    screen here
    Yes, I use one connection in several threads. Some of them can be aborted. After that connection spoils its mutex I can open/close it but I can't reuse it any more,- for an example execute DB2Command.ExecuteReader().
    Is it a bug from IBM or they have expected I won't use multithreading?
    Did anyone see this issue and\or know how to resolve it?
    Attached Thumbnails Attached Thumbnails AbandonedMutexException.png  

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by evclid View Post
    Yes, I use one connection in several threads.
    Not a good idea.

  3. #3
    Join Date
    Apr 2012
    Posts
    3
    Do you really think it can help me?

  4. #4
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Quote Originally Posted by evclid View Post
    Do you really think it can help me?
    That depends on what kind of help you expect. Documentation clearly states that DB2Connection is not guaranteed to be thread-safe. If you choose to share one connection between multiple application threads (which, as I said, is not a good idea) you must synchronize access to the connection yourself. So, what help do you need?

  5. #5
    Join Date
    Apr 2012
    Posts
    3

    Question

    Oh, link to IBM's documentation is better. (I found out exactly page)
    Now I understand it is not good idea. Thank you.
    But I'm confused a little bit : SqlCommand implements BeginExecuteReader().
    I thirst it in DB2!
    After I began using threads I increased performance of loading data by half.
    It worked long time, but since "yesterday" I catch this exception.
    Do you think I should create many connections?

  6. #6
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    Having a separate connection in each thread would be the easiest solution. I don't see what advantage you get by sharing a connection between the application threads.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •