[Live-devel] setlocale 0xc0000374 heap corruption - LOCALE_NOT_USED is OK

Richard Lince richard.lince at bluebox.video
Tue Nov 2 01:03:19 PDT 2021


Hi,

Using the call to:
_configthreadlocale(_ENABLE_PER_THREAD_LOCALE);
at the start of the Live555 engine thread fixed the issue detailed in 
this thread.

Thanks,
Richard.

On 27/10/2021 10:11, Richard Lince wrote:
> Hi Jonathon/Ross,
>
> Thanks for the info Jonathon, humbly missed this, I suspect the heap 
> corruption throw me whilst performing the tests.
> For it's worth, using the libraries for client sink, setlocale is the 
> only call which fails in a multi-threaded environment on a current 
> Windows 10 platform.
>
> I've two options, modify the code to add a lock, which I do not want 
> to do, or understand the consequences of defining LOCALE_NOT_USED.
> As a final note on this email chain, can you tell me what those 
> considerations may be if setlocale is not called?
> What issues may we run into as a client or server endpoint using the 
> libraries not calling this function?
>
> Appreciated,
> Richard.
>
> On 26/10/2021 21:07, Ross Finlayson wrote:
>>> On Oct 27, 2021, at 5:29 AM, Jonathan Brady via live-devel<live-devel at us.live555.com>  wrote:
>>>
>>> 	• On Windows setlocale is not thread safe
>>>https://social.msdn.microsoft.com/Forums/windowsserver/en-US/b46aa226-d337-43c3-8d15-135f6fca9b53/setlocale-behavior-in-multithreaded-applications?forum=vcgeneral
>>> 	• It hasn't been thread safe since Visual C++ 2012.
>>>https://www.tolon.co.uk/2014/10/beware-setlocale/
>> Thanks for the info.  Although we can try to make our code safe to run in multiple threads, there’s not a lot we can do if an underlying language runtime library or OS call is not thread safe.
>>
>> Another reason to avoid threads, if possible.
>>
>>
>> Ross Finlayson
>> Live Networks, Inc.
>> http://www.live555.com/
>>
>>
>> _______________________________________________
>> live-devel mailing list
>> live-devel at lists.live555.com
>> http://lists.live555.com/mailman/listinfo/live-devel
>
> Best Regards,
> Richard Lince,
> Founder & Managing Director
>
> bluebox.video <https://www.bluebox.video>
> +44(0)7841665146
>
> logo

Best Regards,
Richard Lince,
Founder & Managing Director

bluebox.video <https://www.bluebox.video>
+44(0)7841665146

logo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20211102/bf327b03/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logo_email.png
Type: image/png
Size: 6840 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20211102/bf327b03/attachment.png>


More information about the live-devel mailing list