uuid_generate calls system rng (not thread safe?)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Gearman |
Fix Released
|
Medium
|
Brian Aker |
Bug Description
Hi,
libgearman calls uuid_generate from libuuid which uses the system pseudo rng. See the below stack trace. It might be helpful to add some documentation that this happens - it's certainly caused us a few days of being baffled.
Also, given that uuid_generate uses the system RNG, it does not seem thread safe. Does this affect the thread safety of libgearman?
In libuuid, uuid_generate in gen_uuid.c calls random_get_bytes(). This is implemented in lib/randutils.c which is where the calls to the system rng are:
https:/
Note rand() and srand() may be #defined in https:/
Thanks,
Kevin
Stack trace is from Gearman 0.29 I think, but I checked the latest trunk and uuid_generate is called on line 158
Breakpoint 1, 0x00007ffff1daace0 in srandom () from /lib/libc.so.6
(gdb) bt
#0 0x00007ffff1daace0 in srandom () from /lib/libc.so.6
#1 0x00007ffff067f866 in ?? () from /lib/libuuid.so.1
#2 0x00007ffff0680729 in uuid_generate () from /lib/libuuid.so.1
#3 0x00007ffff4a5f515 in add_task (client=..., task=0x7fffffff
context=0x0, command=
workload=..., when=0, actions=...) at libgearman/
#4 0x00007ffff4a60237 in _client_do (client=0x721ab0,
command=
function_
workload_
ret_
#5 0x00007ffff4a60ea0 in gearman_client_do (client=0x721ab0,
function=
workload_
at libgearman/
Changed in gearmand: | |
importance: | Undecided → Medium |
status: | Confirmed → Fix Committed |
milestone: | none → 0.36 |
Changed in gearmand: | |
status: | Fix Committed → Fix Released |
Thanks. The uuid call is not technically required, I'll add an option to make it optional.