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

DeriveParameters caches missing stored procedures #730

Closed
nhathongly opened this issue Oct 23, 2019 · 2 comments
Closed

DeriveParameters caches missing stored procedures #730

nhathongly opened this issue Oct 23, 2019 · 2 comments
Assignees
Labels

Comments

@nhathongly
Copy link

These are my steps to reproduce the issue:

  1. In my running web app, call MySqlCommandBuilder.DeriveParametersAsync to get parameters of an **nonexistent ** stored procedure, then I get a MySqlException which its message is ""Procedure or function 'ABC' cannot be found in database 'XYZ'."
  2. I deploy the stored procedure 'ABC' to the database 'XYZ' while the web app is running
  3. Call MySqlCommandBuilder.DeriveParametersAsync to get parameters of stored procedure 'ABC' again and still get the exception
  4. Restart my web app, and the exception is gone

It seems the cachedProcedure should be checked if it's null before storing it in cachedProcedures

lock (cachedProcedures)
{
cachedProcedures[normalized.FullyQualified] = cachedProcedure;
count = cachedProcedures.Count;
}

@bgrainger
Copy link
Member

null needs to be stored in cachedProcedures as an optimisation for DB server versions that don't support retrieving parameter metadata. (Otherwise, overhead is incurred on every stored procedure execution.)

But it seems that DeriveParameters could always revalidate the stored procedure since this is an explicit action by the user.

@bgrainger bgrainger added the bug label Oct 23, 2019
@bgrainger bgrainger changed the title MySqlException with the message as "Procedure or function '{0}' cannot be found in database '{1}'." was thrown when deriving parameters of s stored procedure DeriveParameters caches missing stored procedures Oct 23, 2019
@bgrainger bgrainger self-assigned this Oct 23, 2019
@bgrainger
Copy link
Member

Fixed in 0.60.3.

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

No branches or pull requests

2 participants