Previously the lock was too fine grained and missed some concurrent access that could result in AttributeError. We implement a slightly changed double-checked locking technique to ensure a fast path when the initialization already occured. Closes #15122
trytond ======= The server of Tryton. Tryton is business software, ideal for companies of any size, easy to use, complete and 100% Open Source. It provides modularity, scalability and security.