Closed imadyTech closed 2 years ago
@silentrock When you say, "switched to Dapper, untill the bug was reported again after several dotnet restarts." do you mean that you still see this when using Dapper instead of EF Core?
@ajcvickers Yes the Dapper also has similar issue. The difference is, there is no incremental number of inotify instances if use "lsof -p dotnetpid |wc -l" command to check the total opened instances. Therefore, asp.net core website works well normally, till I repeated publish-upload-deploy cycle for several times and the error will appears. Restart dotnet will not solve the error, unless you restart the ubuntu system.
@silentrock Based on our initial analysis we believe this is likely an issue with either the MySQL provider, or some layer of MySQL below the provider. You might want to try filing an issue here: https://bugs.mysql.com/
Describe what is not working as expected. I use Asp.net core (Microsoft.NETCore.App 1.1.0 + MySql.Data.EntityFrameworkCore) on both Ubuntu 14.04/16.04. The MVC works well but the database request failed after some times (around 100 queries). I was first blaming the Mysql and switched to Dapper, untill the bug was reported again after several dotnet restarts.
If you are seeing an exception, include the full exceptions details (message and stack trace).
Steps to reproduce
When using mysql, every query to the controller willl increase the value of "inotify instaces" (you may use "lsof -p dotnetpid |wc -l" command to check the value, and you may find the value increases after every query till the error is reported). ----------------------Project.json:---------------------- `{ "title": "ZebaoIntra", "dependencies": { "Microsoft.NETCore.App": { "version": "1.1.0", "type": "platform" }, "Microsoft.ApplicationInsights.AspNetCore": "1.0.0", "Microsoft.AspNetCore.Mvc": "1.0.1", "Microsoft.AspNetCore.Routing": "1.0.1", "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0", "Microsoft.AspNetCore.Server.Kestrel": "1.0.1", "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0", "Microsoft.Extensions.Configuration.FileExtensions": "1.0.0", "Microsoft.Extensions.Configuration.Json": "1.0.0", "Microsoft.Extensions.Logging": "1.1.0", "Microsoft.Extensions.Logging.Console": "1.0.0", "Microsoft.Extensions.Logging.Debug": "1.0.0", "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0", "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", "Microsoft.EntityFrameworkCore.Sqlite": "1.1.0", "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final", "Microsoft.EntityFrameworkCore.Design": { "type": "build", "version": "1.0.0-preview2-final" }, "Microsoft.AspNetCore.Mvc.WebApiCompatShim": "1.0.1", "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0", "Microsoft.AspNetCore.StaticFiles": "1.0.0", "Swashbuckle.AspNetCore": "1.0.0-rc3", "ZBModels": "1.0.0-", "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final", "Common": "1.0.0-", "MySql.Data": "7.0.7-m61", "MySql.Data.EntityFrameworkCore": "7.0.7-m61", "Dapper": "1.50.2" },
"tools": { "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final", "Microsoft.EntityFrameworkCore.Tools": { "version": "1.1.0-preview4-final", "imports": [ "portable-net45+win8+dnxcore50", "portable-net45+win8" ] } },
"scripts": { "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ] }, "userSecretsId": "aspnet-ZebaoAPI-20170329055116" }
----------MySQLContext ------------
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks;using Microsoft.EntityFrameworkCore; using ZebaoIntra; using Microsoft.Extensions.Configuration; using MySQL.Data.EntityFrameworkCore.Extensions; using Microsoft.Extensions.DependencyInjection; using ZBModels;
namespace ZebaoIntra {
}
---------------------Startup.cs----------------------
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging;using ZebaoIntra; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json.Serialization; MySQL.Data.EntityFrameworkCore.Extensions; using Microsoft.AspNetCore.Http; using Swashbuckle.AspNetCore.Swagger; using Swashbuckle.AspNetCore.SwaggerGen; using Swashbuckle.AspNetCore.SwaggerUI; using Microsoft.Extensions.PlatformAbstractions; using System.IO; using Microsoft.AspNet.Builder;
namespace ZebaoIntra { public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);
}
-------------------InsuranceController ---------------------
using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using ZebaoIntra; using Newtonsoft.Json; using ZBModels; using Microsoft.EntityFrameworkCore; using System.Net.Http; using Microsoft.AspNetCore.Http; using Microsoft.Net.Http.Headers; using System.IO; using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Authorization; using Dapper; using System.Data; using Microsoft.AspNetCore.Builder; using System.Runtime.InteropServices; using Microsoft.Extensions.Options; using System.Reflection; using Microsoft.Extensions.WebEncoders; using System.Text;namespace ZebaoIntra.Controllers { [Route("[controller]/[action]")] public class InsuranceController : Controller { private MySQLContext _context; private IHostingEnvironment _hostingEnv; private readonly ConnectionStringsOptions _options;
[HttpGet] public async Task
} `
`using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks;
namespace ZBModels { public class ZBProductsVM : ipninsurance { public DateTime UPDATETIME { get; set; }
}
using System;
namespace ZBModels { public class ipn_insurance_combination { public int ID { get; set; } public DateTime CREATETIME { get; set; } //public DateTime MODIFYTIME { get; set; } public String COMPANY { get; set; } public string NAME { get; set; } public string CONTENT { get; set; } public bool ISACTIVE { get; set; } public bool ISDELETED { get; set; } public int? ORDERBY { get; set; } public string REMARK { get; set; } public decimal? PRICE { get; set; } public int? SALEAMOUNT { get; set; } public int? REALSALEAMOUNT { get; set; } public string TYPE { get; set; } public String TIMELENGTH { get; set; } public string HEADPHOTO { get; set; } public int? INSURANCESINGLE_ID { get; set; } public String NOTETERMS { get; set; } public String HEALTHINFORMED { get; set; } public String EXCEMPLE { get; set; } public String TERMS { set; get; } public string WARRANTIES { get; set; } public string CLAIMS { get; set; } public string electronicPolicy { get; set; } public string EFFECTIVETIME { get; set; } public string STARTPERIOD { get; set; } public string STOPPERIOD { get; set; } } } `
Further technical details
EF Core version: "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0", "Microsoft.EntityFrameworkCore.Sqlite": "1.1.0", "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final", "Microsoft.EntityFrameworkCore.Design": { "type": "build", "version": "1.0.0-preview2-final" }, Database Provider: "MySql.Data.EntityFrameworkCore": "7.0.7-m61" Operating system: windows 10 pro version 1607/ OS 14393.1066 IDE: Visual Studio 2015 update3