LexActivator not thread safe

My code may (depending on how it’s configured) spawn separate threads to process data. I’ve added calls to licensing not only in the executable but also in the compiled library so I can sell the two separately. I have the calls in base classes such that any creation of an object checks that the license if valid. As long as I have a single thread creating data and launching it, I have no problems. If there’s multiple threads creating data and launching it in parallel, I start getting double free errors, SigAbort, SegFaults, etc. If I comment out the licensing code, recompile and run the same tests with the same seed, everything runs without issue. Faults occur at isGenuine() for trial and non-trial activations. I can provide additions logging if necessary

LexActivator has been thread-safe for a long time. On which OS are you facing the issue? Can you share the logs so can dig down into it?

RedHat x64 Enterprise. I’ll generate some logs and upload them. Perhaps the issue is that I’m calling the licensing from the executable built with a library that is also licensed? In the code it runs like this

–> thread producing data (works fine as long as only one thread is producing data)
–> next thread launches producing data (may cause segfault)
–> next thread launches producing data (cause fault, abort, etc)

debugger shows that the segfault is from the call to isTrialGenuine()

Admittedly this is my first try into licensing and my background is not computer science. I’ve found how to make it work by first compiling the library without licensing and then compiling the executables I release with static linking. I then reenable the licensing in the library and compile static and dynamic version for release so I can also license the library. In this way I can run 1000s of threads in my executable without issue with only the top executable verifying the license at startup rather than every time a new object is created

I’ll upload sometime today


I guess you should only have one copy of the library in your code, either link LexActivator with exe or with the library but not both at the same time.