I've been doing some debugging on this this week as we're currently seeing regular crashes on our production servers. This happens with both Threading=0 and Threading=2.

It appears it's a bug in MyODBC triggered because FreeSWITCH uses a new ODBC environment handle every time it creates a connection.

When a environment handle is created myodbc_init is called and when it's freed it calls myodbc_end. Those functions are not thread-safe. They're protected by a reference counter but they aren't wrapped in a mutex so if the server is busy and they're both called at the same time you can result in some global variables being used after they're freed.

Rebuilding MyODBC with an empty myodbc_end appears to stop the crashes, but I'm not saying that's a good solution. Still looking at it.

On 22 November 2013 at 20:31, Anthony Minessale <anthony.minessale@gmail.com> wrote:
I've always seen Threading=0 as the solution to stability probs.
Basically if the driver already uses mutexing, its better to disable the arbitrary ones in the core of odbc.
For postgres 0 is basically mandatory.



On Fri, Nov 22, 2013 at 2:12 AM, Steven Ayre <steveayre@gmail.com> wrote:
No such thing in the latest versions, they're all threadsafe now (_r is a symlink to the other).

I use it with success. I did find stability problems in libmyodbc when upgrading from 5.0 to 5.5. My solution was to add these to odbc.ini

Option      = 67108864
Threading   = 2

The Threading setting is what stopped the crashes. There's a Jira on the subject and someone else said manually upgrading to a newer version of unixodbc+myodbc also fixed it.

-Steve



On 21 November 2013 18:23, Jeff Leung <jleung@v10networks.ca> wrote:

Try the non-thread safe MySQL library instead of the thread safe one.

 

From: freeswitch-users-bounces@lists.freeswitch.org [mailto:freeswitch-users-bounces@lists.freeswitch.org] On Behalf Of Vik Killa
Sent: Thursday, November 21, 2013 10:22 AM
To: FreeSWITCH Users Help
Subject: Re: [Freeswitch-users] Is MySQL OK to use?

 

short answer no.

use postgres

 

On Thu, Nov 21, 2013 at 12:41 PM, Alex Lake <alex@digitalmail.com> wrote:

I find these "Error in my_thread_global_end()" messages somewhat
annoying in my fs1.2stable on Ubuntu12.04 box. Is there any advice
(other than "don't use MySQL") for how to install it better? Might it be
something to do with thread-safe libraries (I'm using libmyodbc_r.so at
the moment)

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org

 


_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org



_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org




--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

FreeSWITCH-users mailing list
FreeSWITCH-users@lists.freeswitch.org
http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
http://www.freeswitch.org