Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8255435
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:31:21+00:00 2026-06-08T01:31:21+00:00

We have a multithreaded application. One of the worker threads calls GetModuleFilename for logging

  • 0

We have a multithreaded application. One of the worker threads calls GetModuleFilename for logging purposes and we’ve seen a deadlock where the worker threads held a lock before calling GetModuleFilename which blocks forever.

We can and have removed the GetModuleFilename call from inside this lock, but are still very much interested in exactly how the deadlock occurs.

Doing some reading online:
http://blogs.msdn.com/b/oldnewthing/archive/2004/01/28/63880.aspx

it seems that GetModuleFilename will acquire the loaderlock, that seemed like a pretty good candidate for a deadlock.

But generally threads inside the loaderlock would not be executing any of our own code, except in dllmain as per the link above.

a dll_thread_attach or detach might be called in the loaderlock and on another workerthread which is getting created or destroyed, but i don’t see any way this would try to acquire the lock we’re using.

It is also possible that the main thread tries to acquire the lock which the GetModuleFilename thread is holding, and a 3rd thread is holding the loaderlock and doing a sendmessage or something like that blocking on the main thread? Here also i’ve not found any circumstances under which this would happen.

one of the other threads which i’m suspicious of is one which uses a com object. the thread calls coinitialize at the beginning so that should be in single threaded apartment. any possibilities of interaction with loaderlock here?

Anyways we’ve not been able to identify the exact way in which this deadlock occurs. So i’m hoping for some ideas, or some more information about the loaderlock in terms of other cases is it being acquired, and if there are any other scenarios where code would be executed within the loaderlock which has the potential to block.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T01:31:23+00:00Added an answer on June 8, 2026 at 1:31 am

    Well, turns out the problem i described was merely the symptom of a different problem in a library we used. The library apparently used some wininet apis in two different threads, one of which was in dllmain and inside the loaderlock. These two threads deadlocked which subsequently locked up our thread which called GetModuleFileName.

    That’s about as much as i know for now, but i’ll update this once we get some more details back from the vendor of the library.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a multithreaded Windows application where one of the threads has a message
I have a multithreaded application, in which I'm trying to render with different threads.
I have a multithreaded application running on Win XP. At a certain stage one
I have a multithreaded application that is using LinqToSql. One of the things I
We have a WinForms desktop application, which is heavily multithreaded. 3 threads run with
How to handle database connection with multithreaded application. I have developed one application that
I have a situation where, in a multithreaded application, many different threads are accessing
I have a multithreaded application that has many concurrent operations going on at once.
I have a multithreaded application that makes heavy use of OpenSSL in C. It
I have a multithreaded application. However I noticed, I'm using OpenGL and this should

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.