Comment 0 for bug 1095833

Revision history for this message
Oleg Gerovich (oleg-gerovich) wrote :

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!