← Back to team overview

nunit-core team mailing list archive

[Bug 1095833] Re: Microsoft.Hpc.Scheduler test gets an exception

 

Hi Charlie,

Thanks for the pointers!

I am targeting .NET 4.0 in my C# project. I do see nunit-agent appearing
during execution. I tried playing with RequireSTA, but to no avail.

I looked at nunit.exe.config and nunit-console.exe.config for 2.6.2. This is what it looks like with my modifications based on what I found on the web:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
	<!--
   The .NET 2.0 build of the console runner only 
   runs under .NET 2.0 or higher. The setting
   useLegacyV2RuntimeActivationPolicy only applies 
   under .NET 4.0 and permits use of mixed mode 
   assemblies, which would otherwise not load 
   correctly.
  -->
	<startup useLegacyV2RuntimeActivationPolicy="true">
    <requiredRuntime version="v4.0" />
    <supportedRuntime version="v4.0"/>
  </startup>
	<runtime>
		<!-- Ensure that test exceptions don't crash NUnit -->
		<legacyUnhandledExceptionPolicy enabled="1"/>
		<!-- Run partial trust V2 assemblies in full trust under .NET 4.0 -->
		<loadFromRemoteSources enabled="true"/>
		<!-- Look for addins in the addins directory for now -->
		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
			<probing privatePath="lib;addins"/>
		</assemblyBinding>
	</runtime>
</configuration>

With this config, I no longer see nunit-agent being started. I get the same error as with ReSharper:
No connection could be made because the target machine actively refused it 127.0.0.1:6729

I tried adding similar startup entries to app.config of my test project
with the same result.

I'm going to experiment with .NET 4.5 tomorrow. Please let me know if
you have other suggestions. Maybe my config file is wrong.

Regards,
Oleg.

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1095833

Title:
  Microsoft.Hpc.Scheduler test gets an exception

Status in NUnit V2 Test Framework:
  New

Bug description:
  I have the following test:

  using Microsoft.Hpc.Scheduler;
  using NUnit.Framework;

  namespace TestHPC
  {
      [TestFixture]
      internal class TestHpc
      {
          [TestCase("HEAD-NODE-SERVER", 9)]
          public static void AllCoresPresent(string headNode, int expectedCores)
          {
              int totalCores = 0;

              using (IScheduler scheduler = new Scheduler())
              {
                  scheduler.Connect(headNode);
                  ISchedulerCollection nodes = scheduler.GetNodeList(null, null);
                  foreach (ISchedulerNode node in nodes)
                  {
                      totalCores += node.NumberOfCores;
                  }
              }

              Assert.AreEqual(expectedCores, totalCores);
          }
      }
  }

  I am using a Visual Studio 2010 solution that has the project with
  this test build against .NET 4.0. This is the only test in the
  solution.

  If I use NUnit 2.6.0 GUI or console runner, the test hangs in the
  middle.

  If I use ReSharper 7.1.1 Unit Test runner pointed at my local NUnit
  2.6.0 and run the test from the project compiled against 2.6.0
  nunit.framework.dll, the test passes quite quickly.

  If I switch ReSharper to run tests with build-in NUnit 2.6.2 and
  compile against 2.6.2, the test fails with this error:

  Microsoft.Hpc.Scheduler.Properties.SchedulerException : No connection could be made because the target machine actively refused it 127.0.0.1:6729
    ----> System.Net.Sockets.SocketException : No connection could be made because the target machine actively refused it

  Server stack trace: 
     at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.Reconnect()
     at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.HandleException(Exception e)
     at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.EnumerateGroupsForNode(String nodeName)
     at Microsoft.Hpc.Scheduler.Store.NodePropertyHandler.Tags.GetPropFromQuery(QueryContextBase ctx, PropertyId pid, ref StoreProperty prop)
     at Microsoft.Hpc.Scheduler.Store.QueryContextBase.GetPropFromQuery(PropertyId pid)
     at Microsoft.Hpc.Scheduler.Store.QueryContextBase.ExecuteRowSetQuery(List`1 ids, PropertyId[] pids)
     at Microsoft.Hpc.Scheduler.Store.SnapShotRowSet.GetData(Int32 firstRow, Int32 lastRow, ref Int32 rowCount)
     at Microsoft.Hpc.Scheduler.Store.SchedulerStoreInternal.RowSet_GetData(ref ConnectionToken token, Int32 rowsetId, Int32 firstRow, Int32 lastRow)
     at Microsoft.Hpc.Scheduler.Store.SchedulerStoreInternal.RowEnum_GetRows(ref ConnectionToken token, Int32 id, Int32 numberOfRows)
     at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
     at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr, Boolean fExecuteInContext)

  Exception rethrown at [0]: 
     at Microsoft.Hpc.Scheduler.Store.StoreServer.HandleException(Exception e, Boolean asyncReconnect)
     at Microsoft.Hpc.Scheduler.Store.StoreServer.RowEnum_GetRows(Int32 id, Int32 numberOfRows)
     at Microsoft.Hpc.Scheduler.Store.LocalRowEnumerator.GetRows2(Int32 numberOfRows)
     at Microsoft.Hpc.Scheduler.Store.RowEnumeratorEnumerator.MoveNext()
     at Microsoft.Hpc.Scheduler.Scheduler.GetNodeList(IFilterCollection filter, ISortCollection sort)
     at TestHPC.TestHpc.AllCoresPresent(String headNode, Int32 expectedCores) in TestHPC.cs: line 18
  --SocketException

  Server stack trace: 
     at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
     at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
     at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket(EndPoint ipEndPoint)
     at System.Runtime.Remoting.Channels.RemoteConnection.CreateNewSocket()
     at System.Runtime.Remoting.Channels.SocketCache.GetSocket(String machinePortAndSid, Boolean openNew)
     at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.SendRequestWithRetry(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream)
     at System.Runtime.Remoting.Channels.Tcp.TcpClientTransportSink.ProcessMessage(IMessage msg, ITransportHeaders requestHeaders, Stream requestStream, ref ITransportHeaders responseHeaders, ref Stream responseStream)
     at Microsoft.Hpc.ClientSink.ProcessMessage(IMessage message, ITransportHeaders requestHeaders, Stream requestStream, ref ITransportHeaders responseHeaders, ref Stream responseStream)
     at System.Runtime.Remoting.Channels.BinaryClientFormatterSink.SyncProcessMessage(IMessage msg)

  Exception rethrown at [0]: 
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(ref MessageData msgData, Int32 type)
     at Microsoft.Hpc.Scheduler.NodeManagement.INodeQuery.EnumerateNodeGroups()
     at Microsoft.Hpc.Scheduler.NodeManagement.NodeQuery.Reconnect()

  If I use NUnit 2.6.2 GUI or console runner, the test hangs in the
  middle.

  There are no firewalls blocking port 6729 on the HPC server. All I did
  was switch the version of NUnit.

  There seems to be a difference in how ReSharper is launching NUnit
  from the way NUnit GUI and console runner work. If I did not have
  ReSharper, I would have no clue that my test could pass.

  ReSharper's behavior is observed in TeamCity when I run the test using
  NUnit runner. Looks like JetBrains have some consistency across their
  products that work better for execution of NUnit tests than native
  tools.

  I have a variety of other tests that work just fine after the switch,
  so the problem is constrained to Microsoft.Hpc.Scheduler tests (for
  now). I can provide more information if needed. Please help!

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1095833/+subscriptions


References