Problem with EntireX .NET Wrapper

Hi Everyone,

I ran a multi-threading program to make multiple calls to the RPC server. For calls to the natural sub-programs with small Parameter Data Area, they are all successful. However, for calls to the natural subprograms with large PDA, many (NOT all) of the calls weren’t successful. Here are some of the errors I received:

Thread 1 - RPC Error : 00010018: Invalid Memory provided. Location of wrong Parameter is 14.

Thread 8 - RPC Error : 10146974: NATURAL RPC Server Error 6974 occurred.

Thread 3 - RPC Error : 00370042: ATTR: BUFFER-LIMIT for Service reached.
Thread 4 - RPC Error : 00370042: ATTR: BUFFER-LIMIT for Service reached.
Thread 5 - RPC Error : 00370042: ATTR: BUFFER-LIMIT for Service reached.

We also ran similar program using JAVA RPC with the same EntireX/RPC settings, and it worked pretty well although it occasionally gave the “ATTR: BUFFER-LIMIT for Service reached.” error.

We are using EntireX 7.1.1 patch 30/VS.NET 2000/Windows 2000 for the client and Natural RPC Server 5.1.1.0 on VSE.

Does anyone know what caused the problem here and how to fix it?

Thanks,
Chuong

The Broker you are using has various parameter settings in the Broker Attribute file for resources the service can use. The buffers you need to adjust are either the SHORT buffers (if your message is under 2k) or, more likely in your case, LONG buffers - you can use the System Management Hub to verify which you are using and how many (see the high water marks) have been used. The number of concurrent messages, conversations in process at the same time will determine the number of buffers required.

The default limit for long buffers for a service is 20. If your message is 15k, you will need 8 buffers (and twice that if the message is 15k each way) for each message.

There are actually two different issues here:

The 00370042: ATTR: BUFFER-LIMIT for Service reached error. Douglas already described how to handle this.

The other 2 errors are due to a multi-threading problem in the .NET Wrapper. This problem has been corrected with EXX 7.1.1 PL 55.
I suggest to install PL 60 which is a cumulative patch for all components (like PL 30).

Douglas and Rolf - We really appreciate your help.

From your previous suggestions, we upgraded our EntireX client to patch 60, and it did solve some of the problems. However, even though we increased significantly the values of some of the parameters in the EntireX Broker Attribute file, if we run more than 40 threads, approximately 5% of the calls were still giving error code of 0037-0042. In some cases, it even crashed the server, or produced such error codes as 2002-0000, which we could not even find it in the documentation. Meanwhile, with the same settings, I was able to run successfully a java program with 100 threads making more calls and with some larger PDAs. I’ve been struggling for 2 weeks trying to solve this problem, but have not been successful. So, I am posting here as much info as I could, and hopefully, someone will be able to point out what’s wrong.

Thank you very much in advance for your help.

Best Regards,
Chuong


Here’s our EntireX Broker Attribute file:

  • $$ JOB JNM=ETBATTR,CLASS=0,DISP=D
  • $$ LST CLASS=V,DISP=D,DEST=(*,SAGMAINT)
    // JOB ETBATTR
    // EXEC LIBR
    ACCESS S=SAGLIB.ETB62203
    CATALOG ETBATTR.P REPLACE=YES


** ETB Attribute File **



** ENTIRE Broker attributes *******************************************

DEFAULTS = BROKER
AUTOLOGON = YES
AUTOLOGON = YES
BROKER-ID = ETB011
CLIENT-NONACT = 15M
CONV-DEFAULT = 1000
LONG-BUFFER-DEFAULT = 200
NUM-CLIENT = 1000
NUM-CONVERSATION = 5000
NUM-LONG-BUFFER = 1000
NUM-SERVER = 30
NUM-SERVICE = 1000
NUM-SHORT-BUFFER = 8000
NUM-WORKER = 10
SECURITY = NO
SECURITY-PATH = USRSEC
SERVICE-UPDATES = YES
SHORT-BUFFER-DEFAULT = 1000
TRACE-LEVEL = 0
TRACE-LEVEL = 0
NUM-CCOM = 16
NUM-COMBUF = 200
NUM-WQE = 200
*

  • TCP/IP
  • TCPMAXCONN = 50
    TCPPORT = 1996
    TRANSPORT = TCP-NET
  • Persistent Store
  • MAX-UOWS = 30
    MAX-MSG = 1000000
    DEFERRED = NO
    STORE = BROKER
    STORE = BROKER
    PSTORE = COLD
    PSTORE-PATH = BTPSI
    UWSTATP = 1
    UWTIME = 10M

** ENTIRE Broker Services *********************************************

  • ------------- some example services -------------------------

DEFAULTS = SERVICE
CONV-LIMIT = UNLIM
CONV-NONACT = 4M
LONG-BUFFER-LIMIT = UNLIM
NOTIFY-EOC = YES
SERVER-NONACT = 5M
SERVER-NONACT = 5M
SHORT-BUFFER-LIMIT = UNLIM
TRANSLATION = SAGTCHA

CLASS = ACLASS, SERVER = ASERVER, SERVICE = ASERVICE
CLASS = BCLASS, SERVER = BSERVER, SERVICE = BSERVICE
CLASS = CCLASS, SERVER = CSERVER, SERVICE = CSERVICE

  • ------------- Tutorial conversational services --------------

DEFAULTS = SERVICE
CONV-NONACT = 4M
SERVER-NONACT = 5M
TRANSLATION = SAGTCHA

CLASS = ETB, SERVER = Tutorial, SERVICE = CvBackground
CLASS = ETB, SERVER = Tutorial, SERVICE = CvDataFromSrvAsy
CLASS = ETB, SERVER = Tutorial, SERVICE = CvDataToSrvAsy
CLASS = ETB, SERVER = Tutorial, SERVICE = CvDemoDeregQuies
CLASS = ETB, SERVER = Tutorial, SERVICE = CvDemoHold
CLASS = ETB, SERVER = Tutorial, SERVICE = CvParallelAsy

  • ------------- Tutorial non-conversational services ----------

DEFAULTS = SERVICE
CONV-NONACT = 1M
SERVER-NONACT = 5M
TRANSLATION = SAGTCHA

CLASS = ETB, SERVER = Tutorial, SERVICE = NcDemoMultiSrv1
CLASS = ETB, SERVER = Tutorial, SERVICE = NcDemoMultiSrv2
CLASS = ETB, SERVER = Tutorial, SERVICE = NcNoReply
CLASS = ETB, SERVER = Tutorial, SERVICE = NcWithReply
CLASS = ETB, SERVER = Tutorial, SERVICE = NcWithReply

  • ------------- Tutorial special services ---------------------

DEFAULTS = SERVICE
CONV-NONACT = 8M
NOTIFY-EOC = YES
SERVER-NONACT = 10M
TRANSLATION = SAGTCHA

CLASS = ETB, SERVER = Tutorial, SERVICE = Request
CLASS = ETB, SERVER = Tutorial, SERVICE = Wait

  • ------------- NATURAL RPC services --------------------------

DEFAULTS = SERVICE
CONV-NONACT = 5M
CONV-NONACT = 5M
NOTIFY-EOC = NO
SERVER-NONACT = 1M
TRANSLATION = SAGTCHA

CLASS = RPC, SERVER = SRV1, SERVICE = CALLNAT

  • ------------- ENTIRE/X Attach Manager test services----------

DEFAULTS = SERVICE
CONV-NONACT = 5M
NOTIFY-EOC = NO
SERVER-NONACT = 1M
TRANSLATION = SAGTCHA

CLASS = ATCLASS, SERVER = ATMAN, SERVICE = ATTACH
CLASS = EAM, SERVER = ATTEST, SERVICE = SDLDSTC
CLASS = EAM, SERVER = ATTEST, SERVICE = SDLDINT1
CLASS = EAM, SERVER = ATTEST, SERVICE = SDLDINT2

  • ------------------------------------------------------- END -
    /+
    /*
    /&
  • $$ EOJ
      • End of File * * *

Here’s the program that I have used to test the server.

Imports System
Imports System.Threading
Imports SoftwareAG.EntireX.NETWrapper.Runtime
Imports SoftwareAG.EntireX.NETWrapper.Generated.MyMtSAC
Imports System.Diagnostics
Imports System.Threading.ThreadState
Imports System.Text

Public Class WebForm1
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'Put user code to initialize the page here


    Dim i As Integer

    Dim studentIdPin As String(,) = { pairs of ids and pins}

    Dim k As Integer
    For i = 0 To 40
        Dim t As Thread
        Try

            Dim threadObj As New SimpleThread(i)

            t = New Thread(AddressOf threadObj.RunThread)

            t.Start()
            For k = 1 To 50

            Next k

        Catch ex As Exception
            PrintLog.WriteLine("Thread - " & i & " - Exception: " & ex.Message.ToString)
        End Try

    Next
    Debug.WriteLine("All threads started")

End Sub

End Class

Imports System
Imports System.Threading
Imports SoftwareAG.EntireX.NETWrapper.Runtime
Imports SoftwareAG.EntireX.NETWrapper.Generated.MyMtSAC
Imports System.Diagnostics
Imports System.Text
Imports System.IO

Public Class SimpleThread

Dim rpclibObj As New SoftwareAG.EntireX.NETWrapper.Generated.MyMtSAC.Rpclib


Dim countDown As Integer = 5    
Dim threadNumber As Integer    Dim threadCount As Integer = 0
Dim runtimes As Integer = 0
Dim broker As Broker
Dim service As Service


Dim studentIdPin As String(,) = {pairs of ids and pins}

Public Sub New(ByVal i As Integer)
    threadCount = i

End Sub


Public Sub RunThread()


    PrintLog.WriteLine("Thread Count is: " & threadCount)
    threadNumber = threadCount

    Dim i As Integer
    Dim id As String

    i = threadNumber

    id = studentIdPin(i, 0)

    Try

        rpclibObj.p1(...)

        PrintLog.Write(id, p1- Thread " & threadNumber & " - Result: " & Utl019w1_MsgInfo.returnCode.ToString)

    Catch ex As XException
        PrintLog.Write(id, p1- Thread " & threadNumber & " - RPC Error : " & ex.Message)
    End Try


    Try

        'rpclibObj = New SoftwareAG.EntireX.NETWrapper.Generated.MyMtSAC.Rpclib()
        rpclibObj.p2(...)

        PrintLog.Write(id, p2- Thread " & threadNumber & " - Email: " & RetEmailAddr.ToString)


    Catch ex As XException

        PrintLog.Write(id, "p2 - Thread " & threadNumber & " - RPC Error : " & ex.Message)

    End Try


    Try

        rpclibObj.p3(...)

        PrintLog.Write(id, "p3 - Thread " & threadNumber & " - date: " & retRegDate.ToString & " Time: " & retRegTime.ToString)


    Catch ex As XException

        PrintLog.Write(id, "p3 - Thread " & threadNumber & " - RPC Error : " & ex.Message)

    End Try


    Try
    
	rpclibObj.p4(...)

        	PrintLog.Write(id, "p4 - Thread " & threadNumber & " - OK")
    Catch ex As XException
        PrintLog.Write(id, "Test Scores - Thread " & threadNumber & " - RPC Error : " & ex.Message)
    End Try


    'Test ViewGrades


    Try
        
        rpclibObj.p5(...)

        PrintLog.Write(id, "p5 - Thread " & threadNumber & " - OK")

    Catch ex As XException
        PrintLog.Write(id, "p5 - Thread " & threadNumber & " - RPC Error : " & ex.Message)
    End Try


    Try
        rpclibObj.p6(..)
        PrintLog.Write(id, "p6 - Thread " & threadNumber & " - OK")
    Catch ex As XException
        PrintLog.Write(id, "p6 - Thread " & threadNumber & " - RPC Error : " & ex.Message)
    Catch e As Exception
        PrintLog.Write(id, "p6 - Thread " & threadNumber & " - Exception : " & e.Message)

    End Try



    Try

        rpclibObj.p7(...)

        PrintLog.Write(id, "p7 - Thread " & threadNumber & " - OK")
    Catch ex As XException
        PrintLog.Write(id, "p7 - Thread " & threadNumber & " - RPC Error : " & ex.Message)
    Catch e As Exception
        PrintLog.Write(id, "p7 - Thread " & threadNumber & " - Exception : " & e.Message)
    End Try



    Try

        rpclibObj.p8(...)
        PrintLog.Write(id, "p8 - Thread " & threadNumber & " - OK")
    Catch ex As XException
        PrintLog.Write(id, "p8 - Thread " & threadNumber & " - RPC Error : " & ex.Message)

        Exit Sub
    Catch e As Exception
        PrintLog.Write(id, "p8 - Thread " & threadNumber & " - RPC Error : " & e.Message)
    End Try
    Debug.WriteLine("Thread - " & threadNumber & " - finished")

End Sub

End Class

The size of the PDA of programs p1 to p8 as follows (in bytes):

p1: 339
p2: 19
p3: 32
p4: 3979
p5: 2195
p6: 28149
p7: 18541
p8: 552

It’ difficult to tell why your .NET application receives the 0037-0042 while the Java one does not.
Looking at you attribute file I have a few suggestions:

  • replace LONG-BUFFER-DEFAULT=200 with LONG-BUFFER-DEFAULT=UNLIM
  • replace SHORT-BUFFER-DEFAULT=1000 with SHORT-BUFFER-DEFAULT=UNLIM

Check with SMH/Control Center the high water marks for these parameters to see if the maximum still needs an increase.

I would also set NUM-SERVICE to a much smaller value, this will reduce significantly the memory needed by the Broker. I would also reduce NUM-WORKER, usually 2-4 is a good choice.

The error 2002-0000 is documented at least in the 711.PL30/PL60 documentation. This is an internal error, basically telling that an unexpected error situation occurred.

According to other customers the 7.2.1 version of the .NET Wrapper seems to be more performant and robust. In case you are already using .NET Framework 1.1 (which is a pre-req for 7.2.1) you might consider upgrading to 7.2.1 (and don’t forget to download/install hotfix 2).