Blogs, How-to, How-to, Support
The secrets of data locks unlocked
3 March, 2022
5min. reading time
No time to stand still. And no room for downtime in your operation. As a logistics service provider, you perform to you maximum capacity to fulfill the needs of your customers on a daily basis. To do so, an efficient process is a must. Therefore, you work with 3PL Dynamics to streamline your logistic processes. And with success. However, an error can stand in your way and unexpectedly slow down your process. Sometimes, an error occurs without you being able to do anything differently. And without any errors in the codebase of your software solution. Nevertheless, this error does impact your operation immediately. For example the error ‘the record is locked for use in another session’. In this case, data locks are the great culprit. So, do you run into these errors? And do you want to continue your activities as quickly as possible? In this blog, we explain what locks in your system are and how you will be up and running in no time again.
What are data locks?
Though an error slows down your process, after a data lock (or record lock), there is no reason to panic. In fact, a record lock is actually a safeguard to prevent errors in your data. A temporary database lock. The lock is triggered when you access records in your system that cannot be accessed, because there are other activities running on these tables. Then, the record is locked. A data lock can therefore be seen as a waiting process that prevents corrupted data.
Imagine, your colleague changes the contents of a record from process A. And, from process B there are also changes made to the same record. Without a doubt, that will result in errors in your data because changes are made from two sides. So, you want to prevent this.
Locks solve themselves
The locked table will automatically be available again once the process using the table has stopped. These data locks can be found in 3PL Dynamics via ‘Database Locks’. Here, all records that are locked at that time are shown. Do you refresh the list? Then, you would see different records on your screen. That makes sense, as the data in 3PL Dynamics is continuously locked and unlocked. Without harming your system.
A standstill due to lasting data locks
Unfortunately, it can happen that the record stays locked. Or stays locked longer than you would expect, giving you the feeling that your processes stand still. This can have different causes. For example, processes that take longer also take longer to unlock your records again. Like invoice runs. Furthermore, a lock can be caused by multiple job queues demanding information from the same record at once. Then, you also get an error. The same goes for your integration messages.
Locks vs. Deadlocks
A database lock is unfortunate for you at the moment of the error. You must wait. However, eventually 3PL Dynamics unlocks the records automatically and you can continue your activities. Even with longer lasting locks. In case of a deadlock, this is different. We talk about a deadlock when the system enters a cycle in which two different processes are simultaneously waiting for the unlocked data, without any result. Then, one of the sessions will automatically be killed. For example: proces A uses the header of a document. Process B uses the document lines. Proces A then locks the document lines to prevent corrupted data. Proces B does the same for the header. From that moment on, both processes wait for the other part of the document to unlock, before it can continue. In case of a deadlock, this does not happen and your process stand still.
In no time up and running after a deadlock
Via ‘Database Locks’ you can often see what process locks the database. Depending on the cause, you can solve data locks that do not unlock themselves. For example, you can increase the time between runs on different job queue tasks (1). When the error is caused by your integrations, you can increase the ‘Retry Attempts’ of the messages. In that way, you increase the possibility for a record to be unlocked after the second attempt (2). Is the lock somewhere else? Then you can stop entire sessions via scanning sessions (3) or the session overview (4). It is possible your colleagues’ session caused the problem. He may have closed his browser, but the session is still running in the background. How to solve data locks in these four ways, you learn in the how-to video underneath.
Do you need help with solving errors?
Have you deleted all sessions as the last attempt? But does the lock stay active? Then, a system restart can be needed. In ultimate cases, this can solve the problem for you. When you cannot find the cause of the database lock, and this occurs regularly, a performance analysis is the way to go. In this case, we could be looking at a deadlock. During this analysis, we walk through your processes together to take measures against these deadlocks. In that way, we prevent your process will come to a standstill in the future.