-
Notifications
You must be signed in to change notification settings - Fork 934
Fix NH-3023 test #1501
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
Fix NH-3023 test #1501
Conversation
Some French sneaked into the code and commit messages |
* Cease freezing during 20 minutes in case of winner thread early failure. * Support connection string having a password in it. * Do not silently succeed on failing to setup the winner thread.
964af09
to
eac3d48
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks,
Fixed GetConnexionString
and "connexion" in commit message. English and French have borrowed each-other too many words...
@@ -27,7 +29,7 @@ public void ForceDeadlockOnConnection(SqlConnection connection) | |||
{ | |||
using (var scope = new TransactionScope(TransactionScopeOption.RequiresNew)) | |||
{ | |||
using (var cxn = new SqlConnection(connection.ConnectionString + ";Pooling=No")) | |||
using (var cxn = new SqlConnection(connectionString + ";Pooling=No")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connection.ConnectionString
is purged from password, when there is one. This causes the winner thread to fail in such case.
@@ -38,6 +40,7 @@ public void ForceDeadlockOnConnection(SqlConnection connection) | |||
catch (Exception ex) | |||
{ | |||
winnerEx = ex; | |||
winnerLock.Release(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of early failure of the winner thread, the "loser thread" was stuck for 2 minutes. Better release him.
@@ -57,6 +60,8 @@ public void ForceDeadlockOnConnection(SqlConnection connection) | |||
if (winnerEx != null) | |||
_log.Warn("Winner thread failed", winnerEx); | |||
} | |||
// If getting here, expected victim has not fail. If expected winner has failed instead, fail the test. | |||
Assert.That(winnerEx, Is.Null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case of winner thread failure while loser thread does not fail, the test was "succeeding". Prevent this.
There are some issues with this PR. NUnit was consuming much more memory than usual. |
On some other PR I have seen SQL Server eating 750Mb, which was causing issues but was not related to these PR. It looks to me the build agent has memory troubles these days. The changes from this PR looks to me very unlikely to have any impact on memory consumption. Especially if the NH-3023 tests are still succeeding, since it then means it has not run through the most significant changes (releasing semaphore in case of "winner" failure and asserting its failure). |
I have got annoyed by this test when experimenting with AppVeyor build on my repository.