Open maya-rv opened 5 years ago
The first one:
Data race on [0x00000000013bdbb1 : 0x000000000042fbf1/0x00007fdd65a7dae0]:
Read in thread 2 holding lock [0x00000000013bdb58 : 0xffffffffffffffff/0x0000000000000000]
> in worker_main at knot/worker/pool.c:65
...
Write in thread 1 holding lock [0x00000000013bdb58 : 0x000000000042ff5a/0x00007ffc8618cef0]
> in worker_pool_resume at knot/worker/pool.c:180
The code looks as follows:
57 pthread_mutex_lock(&pool->lock);
58
59 for (;;) {
65 if (k = worker_queue_dequeue(&pool->tasks);
67 }
pool->suspended) {
66 task = worker_queue_dequeue(&pool->tasks);
67 }
179 pthread_mutex_lock(&pool->lock);
180 pool->suspended = false;
181 pthread_cond_broadcast(&pool->wake);
182 pthread_mutex_unlock(&pool->lock);
I don't understand why predict is complaining at all. It is even stating both cases are under lock. What is it reporting?
The second case is as follows:
Data race on [0x00000000013bc9e0 : 0x000000000042cfa7/0x00007fdd40434ae0]:
Write in thread 1
> in server_reconfigure at knot/server/server.c:386
380 /* Update TCP+UDP ifacelist (reload all threads). */
381 unsigned thread_count = 0;
382 for (unsigned proto = IO_UDP; proto <= IO_TCP; ++proto) {
383 dt_unit_t *tu = s->handlers[proto].handler.unit;
384 for (unsigned i = 0; i < tu->size; ++i) {
385 ref_retain((ref_t *)newlist);
386 s->handlers[proto].handler.thread_state[i] |= ServerReload;
Read in thread 25
> in tcp_master at knot/server/tcp-handler.c:332
295 unsigned *iostate = &handler->thread_state[dt_get_id(thread)];
329 for(;;) {
330
331 /* Check handler state. */
332 if (unlikely(*iostate & ServerReload)) {
333 *iostate &= ~ServerReload;
this isn't an interesting race: a given's thread thread_state has only one possible reader and only one possible writer. it might be marginally interesting to keep reporting this, the fact it isn't problematic relies on how "a write to unsigned is atomic", and I suspect this isn't guaranteed for all architectures.
This may be more than one issue. I'm labelling it runtime
, for now. I think the condvar
branch will fix this, but it's tricky to merge to master
because it makes a number of changes to how the runtime's function interposition works, and it stops us from suppressing system symbols in the reports.
This is the output, and I have to write it down somewhere in order to discuss it. I only managed to get knot to answer with REFUSED, but I tried to run knotc and reloaded configuration a bunch, which is the likely trigger for these reports, once knot is killed.