When I use @time to time a particular function that reads and write from/to several large files, the output shows (for example):
0.403770 seconds (6.20 k allocations: 233.059 MiB, 8.12% gc time, 4 lock conflicts
I’ve never seen these lock conflicts reported before. Are they new in v1.11? What do they mean?
My code isn’t generating any other errors and, on the face of it, seems to be working. Are these lock conflicts important, can I ignore them, or do I need to eliminate them?
Lock conflicts are when 2 different locations try to take the same lock at the same time (causing one to have to wait until the other is done). In this case, the lock is likely one in the IO system.
The open function takes a lock keyword argument. Setting lock = false will disable locking. If you’re not doing concurrent IO, I suppose you could safely turn off locking.
Your code is fine. Like the other metrics reported by @time, lock conflicts can be problematic for performance, but not for correctness. Your code is successfully doing what you asked it to do.
Don’t try to eliminate them unless you know what you’re doing. That could lead to correctness issues.
The conflicts I’m seeing all seem to be arising from Arrow.jl and so I’m not going to try to resolve them. As I say, there is no other sign of trouble in my case.