AccessViolation Thrown when the server is started. RRS feed

  • Question

  • I'm a software tester. My recent task is to test the exposed methods of our C# server which is using WCF as communication layer.

    I wrote a piece of C# code to tets our server. for one of the test, I had to test whether the server is throwing up AddressAlreadyUsed exception when multiple instance of the server is started up.

    Ex, my pseudocode
    while(till count reaches a limit)
    Process.Start("server info);

    During the execution, many instance of the server was started up and it throwed AddressAlreadyUsed exception as expected. But, for some server instance it throwed up an AccessViolation exception.

    The C# code is in turn calls a C++ function.

    But, when I introduced a sleep(400 ms) between subsequent server calls the issue was not occuring.

    ex code
    21-Jul-2009 15:26:32.71 Error: Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
    at sFabServer.returnEntry(sFabServer* , sTString<char>* )       // C++ call
    at SSM.BCT.Legacy.FabServerConfig.ReturnEntry(String name)
    at SSM.BCT.ProcessServer.Server.ServerContext..ctor(P rocessServerConfig config,

    Can any one let me know why this was thrown up and is there any un-safe code/thread in the server that spaned up but not killed?

    Is there a possibility for a bug in the CLR?  I'm using the .net framwwork 3.5 sp1.


    Thursday, July 30, 2009 7:01 AM


  • No, it's a bug in the C++ code.  Probably a threading race condition if changing the timing avoids the problem.  Pass it back to the C++ programmer to fix.

    Hans Passant.
    Thursday, July 30, 2009 10:43 AM