Skip to content

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

Merged
merged 2 commits into from
Dec 23, 2017
Merged

Conversation

fredericDelaporte
Copy link
Member

@fredericDelaporte fredericDelaporte commented Dec 23, 2017

  • 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.

I have got annoyed by this test when experimenting with AppVeyor build on my repository.

@hazzik
Copy link
Member

hazzik commented Dec 23, 2017

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.
Copy link
Member Author

@fredericDelaporte fredericDelaporte left a 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"))
Copy link
Member Author

@fredericDelaporte fredericDelaporte Dec 23, 2017

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();
Copy link
Member Author

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);
Copy link
Member Author

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.

@hazzik hazzik added this to the 5.1 milestone Dec 23, 2017
@fredericDelaporte fredericDelaporte merged commit 82e6e1c into nhibernate:master Dec 23, 2017
@fredericDelaporte fredericDelaporte deleted the NH-3023 branch December 23, 2017 22:58
@hazzik
Copy link
Member

hazzik commented Dec 23, 2017

There are some issues with this PR. NUnit was consuming much more memory than usual.

@fredericDelaporte
Copy link
Member Author

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).

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

Successfully merging this pull request may close these issues.

2 participants