darconeous / libnyoci

A flexible CoAP stack for embedded devices and computers. RFC7252 compatible.
Other
27 stars 10 forks source link

Frequent warning "Requirement Failed (self->timers != timer)" #5

Closed snej closed 6 years ago

snej commented 6 years ago

I'm seeing this warning logged frequently, in debug builds:

libnyoci/src/libnyoci/nyoci-timer.c:117: Requirement Failed (self->timers != timer)

Here's the backtrace; this is happening on a background thread that's simply calling nyoci_plat_wait and nyoci_plat_process in a loop:

  * frame #0:`nyoci_schedule_timer(self=0x0000000103001e00, timer=0x00000001007019c0, cms=2147483647) at nyoci-timer.c:118
    frame #1:`nyoci_handle_response at nyoci-transaction.c:877
    frame #2:`nyoci_inbound_packet_process(self=0x0000000103001e00, buffer="bEXRURC5a2 a*\xb1%\377, packet_length=434, flags=0) at nyoci-inbound.c:433
    frame #3:`nyoci_plat_process(self=0x0000000103001e00) at nyoci-plat-net.c:925
    ...
darconeous commented 6 years ago

Yeah, that's a bug.

You know, I think it would be easier to just have nyoci_schedule_timer() automatically invalidate the timer if it is being rescheduled. I can't think of a good reason to force everyone to invalidate it beforehand.

Will fix.