Bug 35866 - ServiceHost cctor param causes MySQL transaction
Summary: ServiceHost cctor param causes MySQL transaction
Status: RESOLVED UPSTREAM
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: unspecified
Hardware: All Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-11-14 17:43 UTC by jakub.fojtik.gm
Modified: 2015-11-17 01:10 UTC (History)
3 users (show)

Tags: ServiceHost, WCF, MySQL
Is this bug a regression?: ---
Last known good build:


Attachments
Simple example Visual Studio solution with binaries (1.48 MB, application/octet-stream)
2015-11-14 17:43 UTC, jakub.fojtik.gm
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED UPSTREAM

Description jakub.fojtik.gm 2015-11-14 17:43:46 UTC
Created attachment 13813 [details]
Simple example Visual Studio solution with binaries

When a WCF service is created by the constructor:

    public ServiceHost(object singletonInstance, params Uri[] baseAddresses);

which receives a second argument (an Uri), and if later a MySQL transaction is opened, an *additional* MySQL transaction will be started before the coded one, which causes a MySQL error.

Simply commenting the Uri parameter removes the exception.

Which suggests that the MySQL Connector is being influenced by some WCF code which is crazy. But the behavior is consistent on repeated runs and also on different machines.


Mono versions: 4.0.5, and also 4.0.3
Target .NET version: 4.5.2, 4.0.0, probably all
Linux: LUbuntu 15.10, Debian, probably all
MySQL: 6.9.8 MySQL.Data ADO.NET nuget

Simple test solution is attached. I simply start the exe with mono-service and the error is written to ./error.txt.

Exception returned:

System.InvalidOperationException: Nested transactions are not supported.
  at MySql.Data.MySqlClient.ExceptionInterceptor.Throw (System.Exception exception) [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlConnection.Throw (System.Exception ex) [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlConnection.BeginTransaction (IsolationLevel iso) [0x00000] in <filename unknown>:0 
  at MySql.Data.MySqlClient.MySqlConnection.BeginTransaction () [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) MySql.Data.MySqlClient.MySqlConnection:BeginTransaction ()
  at WindowsService1.Service1.OnStart (System.String[] args) [0x00000] in <filename unknown>:0 

The only possibly relevant explanation i could find is this one: https://bugzilla.xamarin.com/show_bug.cgi?id=14844
But that is not even about a database transaction, just some WCF one. Or maybe there is some shared pipe/socket/something where the MySQL driver could see the (posibly identical) BEGIN command and pick it up?

I realize this might just as well be a problem on MySQL's side and will report the bug to them too if you don't find anything in your code. But MySQL should not be reachable from some WCF service code no matter what, so i guess the bug is in their interconnection provided by Mono.
Of course everything works on Windows without Mono or i wouldn't have reported it as a bug.
Comment 1 Rodrigo Kumpera 2015-11-17 01:10:06 UTC
Mono doesn't ship a MySql driver. You should engage its maintainer instead.