on 05-19-2011 3:50 PM
Usind DI API for SAP 8.8 PL20
There's no entry in the Event Viewer obviously it's something wrong in SAP.
How can I know what's the problem ?
The application that is using DI API, is performing it's job every minute of every day without any trouble until 2 or 2 times a day, it crashes like this.
I would like to know how I can debug, profile or anything I could do to know what's the source of the problem.
Thank you for any hints.
Hi Marc,
Considering the frequency with which you run your code, it actually surprises me that you only encounter this one once or twice a day (we get it A LOT).
You can use the trick that I use for this (it is in VB.NET, so you may have to adapt it to whatever language you code in):
TRY_AGAIN:
If YourObject.Add() <> 0 then
Dim errCode As Integer
Dim errMsg As String
YourCompanyObject.GetLastError(errCode, errMsg)
If errCode.ToString LIKE "*2038*" Then
'Wait half a second or so
Threading.Thread.Sleep(500)
'And then just try it again
GoTo TRY_AGAIN
Else
'Do whatever other error handling here
End If
End If
Depending on the scenario, there is a risk of this blocking your program for a longer time than is allowed, so we also use a version with a little counter so it can only try again so many times.
Good luck,
Johan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sorry to resurrect an old thread... I occasionally get error -5002, which after retries the error goes away... So could you please confirm that I need to do automatic retry if I get this error? (along with -2038 and -1116)
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey guys, I can't say thank you enough for this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The error Internal error (-2038) is usually related to database deadlocks, as explained in a few notes on the portal:
1414834 - DI_Error -2038 when update orders with multiple users
1231885 - DI_Error when two programs try to access the same object
1113543 - DI_Database deadlocks when maintaining JE concurrently
1489753 - Deadlock while adding Marketing Documents simultaneously
etc. - I got 11 notes relating the B1 with that error when I searched on service.sap.com/notes
So most likely it is due to either your application is accessing the same object as a user at the same time, or something is happening with transaction if you are suing it.
To actually monitor what is happening, two options:
1. SQL profiler - run the profiler for the day and then use the timestamp in your log to check the sql profile and see what was happening
2. Use the B1 Test Tools available on the SDN, which include a .NET profiler and a DB Proifler that you can use to analyze whats going on. (http://www.sdn.sap.com/irj/sdn/index?rid=/webcontent/uuid/cbb70163-0c01-0010-9b8c-f6ee72de7328 [original link is broken])
But before using your time up with those tools, see is there something you can do to prevent the deadlock - or check are you using a version of B1 that has a bug that was fixed in a later version. (explained in the notes)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.