Another user has modified the record...
ta5
Member Posts: 1,164
Hi
I have a strange error with two processes running concurrently.
This is an example.
I could use selectlatestversion or a commit in Codeunit A, but I actually dont understand where the problem is. The get in Codeunit A has been sent after Codeunit B has finished :?
Thanks
Thomas
I have a strange error with two processes running concurrently.
This is an example.
-
Table x with 1 Record
Codeunit A does something which takes 10 seconds, to reproduce it it could be just sleep(10000)
Codeunit B modifies the record in Table x while Codeunit A is working/sleeping
Codunit A is started, then Codeunit B from another Workstation
Codeunit B takes only a few miliseconds and finishes then
After Codeunit A has finished the first part, there is a get on the record in Table x and then a modification
On modification I'm getting the Error "Another user has modified the record for x..."
I could use selectlatestversion or a commit in Codeunit A, but I actually dont understand where the problem is. The get in Codeunit A has been sent after Codeunit B has finished :?
Thanks
Thomas
0
Comments
-
-
No, I don't.
Acutally I could use it but I dont understand why the problem occurs.
The codeunit who changes the table has finished and the get in the actual codeunit is excecuted after the mentioned codeunit has finished.
Any ideas?
Thanks
Thomas0 -
Without seeing the code it’s difficult to see the error, but using lock table should solve your problem.0
-
I am also experiencing the same problem.
The code is running between couple of tables and several functions of codeunit. Two variables are using one table and are modified at different point of time in different functions.
The Hierarcy is something like this :
SalesHeaderVar1 is initiated and then SalesHeaderVar2 is initiated. SalesHeaderVar2 is modified and then SalesHeaderVar1 is modified.
The error appears when SalesHeaderVar1 is modified. Is there anyway to solve this.CA Sandeep Singla
http://ssdynamics.co.in0 -
This is Codeunit a
Window.OPEN('wait 10'); SLEEP(10000); Window.CLOSE; TestTable.GET; TestTable.description := FORMAT(TIME) + ' 1'; TestTable.MODIFY;
This is Codeunit bTestTable.GET; TestTable.description := FORMAT(TIME) + ' 2'; TestTable.MODIFY;
Codeunit b is started while Codeunit a is waiting (sleep). I know that I can use locktable or commit in Codeunit a but I wonder why I get an error at all.
Regards
Thomas0 -
I have seen a few problems with threads and NAV, try using yield.0
-
Yes, that kind of coding will give error.
Don’t forget that the concept of optimistically concurrency is violated there, so will give error in modify.
You can’t change a record that was previously read and try to change it later. Records have timestamps and are different after modify.0 -
nunomaia wrote:You can’t change a record that was previously read and try to change it later. Records have timestamps and are different after modify.
This is exactly, what I dont understand. Imho the GET on the table is executed a long time after the codeunit b has finished. :?0 -
Anyone more info on that?
Thanks in advance
Thomas0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 610 NAV Courses, Exams & Certification
- 1.9K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 251 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions