2012-03-03 11 views
0

MysqlMembershipに対してUserName/Password認証を行うカスタムhttpModuleを持つWCF Webサービスがあります。MysqlMembership Membership.ValidateUser負荷が軽い場合のデッドロックの問題

public void Init(HttpApplication application) 
    { 
     application.AuthenticateRequest += new EventHandler(this.OnAuthenticateRequest); 
     application.EndRequest += new EventHandler(this.OnEndRequest); 
    } 

    public void OnAuthenticateRequest(object source, EventArgs eventArgs) 
    { 
      ... 
      ... 

      if (Membership.ValidateUser(username, password)) 
      { 

サービスの負荷テストを開始したとき、わかりにくい問題が発生しました。リクエストは、Membership.ValidateUserコールにランダムに失敗します。負荷テスターの各スレッドで同じユーザー名/ログインを使用しています。エラーは次のとおりです。

[MySqlException (0x80004005): Deadlock found when trying to get lock; try restarting transaction] 
    MySql.Data.MySqlClient.MySqlStream.ReadPacket() +506 
    MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int32& insertedId) +450 
    MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force) +131 
    MySql.Data.MySqlClient.MySqlDataReader.NextResult() +1216 
    MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) +2191 
    MySql.Data.MySqlClient.MySqlCommand.ExecuteNonQuery() +27 
    MySql.Web.Security.MySQLMembershipProvider.ValidateUser(String username, String password) +1092 

    [ProviderException: An exception occurred. Please check the Event Log.] 
    MySql.Web.Security.MySQLMembershipProvider.ValidateUser(String username, String password) +1481 
    MyApplication.UserAuthenticator.UserNameAuthenticator.OnAuthenticateRequest(Object source, EventArgs eventArgs) in C:\Develop\MyProject\MyProject.UserAuthenticator\UserNameAuthenticator.cs:123 
    System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +80 
    System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)  +270 

アイデアはありますか?

おかげで、 AFrieze

答えて

0

パスワードが無効であることが判明した場合検証のユーザーは、無効なパスワードの試行をインクリメントするために、行をロック:あなた以来

If an incorrect password is supplied to the ValidateUser method, the internal counter that tracks invalid password attempts is incremented by one. This can result in the user being locked out and unable to log on until the lock status is cleared by a call to the UnlockUser method. If the correct password is supplied and the user is not currently locked out, then the internal counters that track invalid password and password-answer attempts are reset to zero. For more information, see the MaxInvalidPasswordAttempts and PasswordAttemptWindow properties.

http://msdn.microsoft.com/en-us/library/system.web.security.sqlmembershipprovider.validateuser.aspx

デッドロックを得ることができるすべての要求に対して同じユーザーを使用しています。

+0

lastActivityDateで実際のエラーがデッドロックしていましたが、同じ効果がありました。 – AFrieze

関連する問題