Giter Club home page Giter Club logo

Comments (4)

cdannebe avatar cdannebe commented on September 27, 2024 1

Hi,
if I use /MTd the crash happens. But if I call FreeLibrary in reverse order to LoadLibrary the crash does not happen.
The debugger shows me that the crash is always somewere in boost::interprocess.

Christian

from interprocess.

fsmoke avatar fsmoke commented on September 27, 2024

I have got the same issue right now!

Crash appears inside

intermodule_singleton_common.hpp

inside function

static void atexit_work()
   {
      intermodule_singleton_common<ThreadSafeGlobalMap>::finalize_singleton_logic
         (this_module_singleton_ptr, this_module_singleton_initialized, singleton_destructor);
   }

this function called twice - cos std::atexit - called twice inside 2 different dlls
so two singletons were created - ...i suppose this sigletons use some shared resources(may be pointers) - as result new and delete called for different memory managers

from interprocess.

cdannebe avatar cdannebe commented on September 27, 2024

Hi,
I think I solved the issue (maybe just for me). The problem isn't the /MTd switch of the compiler.
I think the problem is related to the singleton implementation inside boost::interprocess::shared_memory_object. My project structure is as follows:

An EXE file loads a DLL (a driver wrapper) which can load several device driver DLLs in parallel. Two of the driver DLLs are using their own shared_memory_object's as described in the doc and it work in both cases. Until I call FreeLibrary for the driver DLLs. In that case always the second FreeLibrary crashes (but not with /MDd I didn't understand this seconds fact, sorry).

I solved the issue by creating a boost::interprocess::shared_memory_object inside the driver wrapper DLL. I just instantiate such an object and in the next line I remove it. If I do this, my DLLs don't crash any more.

I hope this helps the developer of boost::interprocess.

Kind regards,
Christian

from interprocess.

cdannebe avatar cdannebe commented on September 27, 2024

My mistake was not related to boost or compiler flags nor something else of the above. I used thread synchronisation mechanisms during unloading the DLLs (PROCESS_DETACH in dll_main()). As mentioned in the Microsoft documentation this results in an undefined behaviour of the application! After redesigning my DLLs the shared_memory_objects and the entire software works stable. Maybe this helps someone.

from interprocess.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.