Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MySqlConnector for async I/O #7

Open
bgrainger opened this issue Jan 27, 2018 · 3 comments
Open

Use MySqlConnector for async I/O #7

bgrainger opened this issue Jan 27, 2018 · 3 comments

Comments

@bgrainger
Copy link

bgrainger commented Jan 27, 2018

The MySqlSink code uses ExecuteNonQueryAsync. It's a long-standing bug in MySql.Data (bug 70111) that async I/O is not implemented correctly; thus all these methods will actually run synchronously. (See also here and here on Stack Overflow.)

To fix this, you could switch to https://github.com/mysql-net/MySqlConnector, an OSS replacement for MySql.Data that supports true asynchronous I/O.

If you're interested in this, I'd be happy to open a PR.

@saleem-mirza
Copy link
Owner

@bgrainger thanks for stepping up to resolve this issue. Honestly, this sink is not directly impacting application for flow you have posted. Application will not be waiting for data to be serialized as I'm using pub-sub pattern.

However, I'd love to see what will be impact if underlying connector get swapped. Please fee free to raise a pull request and I'm all up to evaluate it.

bgrainger added a commit to mysql-net/serilog-sinks-mysql that referenced this issue Jan 29, 2018
@julianonunes
Copy link

Did you have any problems moving the project to MySqlConnector? I'm also having a problem because of two projects referencing different libraries.

@bgrainger
Copy link
Author

If at all possible, you will want to avoid referencing both MySql.Data and MySqlConnector. Having both running will create duplicate connection pools, which is inefficient. MySql.Data also has a number of outstanding bugs that might affect your application.

But if it's unavoidable (because some dependencies haven't updated), you may be able to resolve problems by using extern aliases; see the comments on mysql-net/MySqlConnector#189 for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants