MantisBT - opensim
View Issue Details
0008225opensim[REGION] OpenSim Corepublic2017-07-31 17:072020-07-19 22:04
newnot fixable 
Standalone (1 Region)
Mono / OSX
0008225: Upgrade of .NET MySql Connector to v 6.9.9 doesn't handle unix sockets in ConnectionString
This is a bug in the version of the MySql connector which to my knowledge still exists in 6.10.0, but when it is fixed, we should upgrade this again.

The MySql connector ignores the Protocol = unix component of the ConnectionString, treats the socket like it's a url and tries to do a DNS lookup which fails and causes a crash. This bug has been reported here: [^]
In the [DatabaseService] section of StandaloneCommon.ini or the equivalent robust/hg ini, set the ConnectionString to use 'Protocol = unix' and 'Data Source = <unix socket path>' like the following:
ConnectionString = "Data Source=/Applications/MAMP/tmp/mysql/mysql.sock;Protocol=unix;Database=osdb;User ID=osuser;Password=mySecPW;Old Guids=true;"
This is the stack trace produced:

[SERVICE BASE]: Failed to load plugin OpenSim.Region.Framework.Interfaces.ISimulationDataStore from OpenSim.Data.MySQL.dll with args Data Source=/Applications/MAMP/tmp/mysql/mysql.sock;Protocol=unix;Database=osdb;User ID=osuser;Password=mySecPW;Old Guids=true;System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> MySql.Data.MySqlClient.MySqlException: Unable to connect to any of the specified MySQL hosts. ---> System.Net.Sockets.SocketException: Could not resolve host '/Applications/MAMP/tmp/mysql/mysql.sock'
  at System.Net.Dns.Error_11001 (System.String hostName) <0x30ff4b0 + 0x0006b> in <filename unknown>:0
  at System.Net.Dns.GetHostByName (System.String hostName) <0x30fd608 + 0x00057> in <filename unknown>:0
  at System.Net.Dns.GetHostEntry (System.String hostNameOrAddress) <0x30fd478 + 0x0008b> in <filename unknown>:0
  at MySql.Data.Common.MyNetworkStream.GetHostEntry (System.String hostname) <0x30fbdc8 + 0x0002b> in <filename unknown>:0
  at MySql.Data.Common.MyNetworkStream.CreateStream (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings, Boolean unix) <0x30fbc50 + 0x0003f> in <filename unknown>:0
  at MySql.Data.Common.StreamCreator.GetUnixSocketStream (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) <0x30fbb88 + 0x00027> in <filename unknown>:0
  at MySql.Data.Common.StreamCreator.GetStream (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) <0x30fba28 + 0x0004b> in <filename unknown>:0
  at MySql.Data.MySqlClient.NativeDriver.Open () <0x30fb000 + 0x00027> in <filename unknown>:0
  --- End of inner exception stack trace ---
  at MySql.Data.MySqlClient.NativeDriver.Open () <0x30fb000 + 0x000f3> in <filename unknown>:0
  at MySql.Data.MySqlClient.Driver.Open () <0x2e45850 + 0x00039> in <filename unknown>:0
  at MySql.Data.MySqlClient.Driver.Create (MySql.Data.MySqlClient.MySqlConnectionStringBuilder settings) <0x2e41770 + 0x00136> in <filename unknown>:0
  --- End of inner exception stack trace ---
  at System.Reflection.MonoCMethod.InternalInvoke (System.Object obj, System.Object[] parameters) <0x1a56c50 + 0x0007b> in <filename unknown>:0
  at System.Reflection.MonoCMethod.DoInvoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x1a56ae0 + 0x000c6> in <filename unknown>:0
  at System.Reflection.MonoCMethod.Invoke (BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x1a56d00 + 0x00041> in <filename unknown>:0
  at System.RuntimeType.CreateInstanceImpl (BindingFlags bindingAttr, System.Reflection.Binder binder, System.Object[] args, System.Globalization.CultureInfo culture, System.Object[] activationAttributes, System.Threading.StackCrawlMark& stackMark) <0x1887740 + 0x00549> in <filename unknown>:0
No tags attached.
Issue History
2017-07-31 17:07colosiNew Issue
2017-07-31 17:47colosiGit Revision or version number => 52d4cf692caf4907e22089733fea080a081e3233
2017-07-31 17:47colosiPrioritylow => normal
2017-08-01 05:34UbitUmarovNote Added: 0032231
2017-08-01 11:53colosiNote Added: 0032232
2017-08-01 11:54colosiPrioritynormal => none
2017-08-01 11:54colosiResolutionopen => not fixable
2020-06-09 10:07Gwyneth LlewelynNote Added: 0036536
2020-07-19 22:04Ferd FrederixNote Added: 0036628

2017-08-01 05:34   
.NET MySql Connector to v 6.9.9 is the most recent version that still supports servers 5.0 [^]
and from bug report you show, is not clear 6.10 did fix it.
at this point, you can use another version, either the one provided in 0.8.2 or
one from: [^]
2017-08-01 11:53   
I switched to using a tcp port on localhost, so this is working for me now; but I wanted it documented in case anyone else runs into it. Now that I've found workaround and you've mentioned another, I'll lower the priority. Hopefully, at some point, they'll release a new version where this is fixed and we can upgrade then. Nothing to do until then.
Gwyneth Llewelyn   
2020-06-09 10:07   
Still not fixed? There are good reasons for using a Unix socket as opposed to a TCP socket as a 'workaround' — namely, a certain degree of security (the MySQL server is not exposed to the public Internet 'by mistake').

Here are my findings, basically replicating what @colosi reported: [^]

This is the _first_ MySQL connection implementation that I've found that does _not_ support connection through a Unix socket! (formerly, I used a different MySQL configuration, which did require TCP sockets for remote sync'ing, so I wasn't aware of this issue until today)
Ferd Frederix   
2020-07-19 22:04   
Not sure this helps, but if you use localhost as the address, the mysql driver on Linux behaves differently. It will use sockets automatically. [^]

"On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs: the client connects using a Unix socket file. The --socket option or the MYSQL_UNIX_PORT environment variable may be used to specify the socket name."

"The --protocol option enables you to use a particular transport protocol even when other options normally result in use of a different protocol. That is, --protocol specifies the transport protocol explicitly and overrides the preceding rules, even for localhost."