[patch] Postgres: InitialisePostgres3 is not threadsafe
Original Reporter info from Mantis: ludob
-
Reporter name: Ludo Brands
Original Reporter info from Mantis: ludob
- Reporter name: Ludo Brands
Description:
When 2 threads call InitialisePostgres3 in the same time, the first one loads the library and loads the pointers to the library functions. The second sees that the refcount is >0 and thinks the library is loaded while thread is sometimes still doing the load. Result is uninitialized function pointers.
The patch puts loading/unloading libraries in a critical section. Since postgres3dyn and DllistDyn load the same library, the critical section is common and defined in DllistDyn.
This is a common problem for all dynamic library loading in sqldb. Patches for other DB's will follow.
Mantis conversion info:
- Mantis ID: 24497
- Build: 24588
- Version: 2.7.1
- Fixed in version: 2.6.4
- Fixed in revision: 25111 (#dd7ded48)
- Target version: 3.0.0