CreateGUID fails regularly when multiprocessing
Original Reporter info from Mantis: Phil
-
Reporter name:
Original Reporter info from Mantis: Phil
- Reporter name:
Description:
CreateGuid fails regularly when used in a multiprocessing context.
The culprit is in rtl/linux/suuid.inc's CreateKernelGUID:
fd:=FileOpen(KernelUUID,fmOpenRead);
If CreateGuid is called when another process has /proc/sys/kernel/random/uuid open, CreateKernelGUID's FileOpen fails, causing it to fall back on GetRandomBytes, which often produces duplicate GUIDs.
Solution: Open file in shared, rather than exclusive, mode:
fd:=FileOpen(KernelUUID,fmOpenRead or fmShareDenyWrite);
Fix in GetURandomBytes too - same problem attempting to open /dev/urandom.
Needs to be fixed in rtl/bsd/suuid.inc.
Mantis conversion info:
- Mantis ID: 31555
- OS: Linux
- OS Build: 16.04
- Platform: x64
- Version: 3.0.0
- Fixed in version: 3.1.1
- Fixed in revision: 35611 (#5bbf299c)
- Target version: 3.2.0