aiocoap icon indicating copy to clipboard operation
aiocoap copied to clipboard

Observations can persist in the background

Open chrysn opened this issue 7 years ago • 1 comments

When an observation is requested (by sending the Observe option) but not used (by hooking to the set_callback of the response's .observation and .cancel()ing it when not needed any more), the observation stays active in the background.

Correct use of the API is to call .cancel(), but it'd still be better if GC'd objects don't linger around in active observations. Previous versions of the software (up to including 0.4a1) caught the error, canceled the observation and showed a warning.

chrysn avatar Mar 07 '18 12:03 chrysn

The core of the problem is that we still have the register_callback, and can thus not fully rely on the "pull" of references so that lack of pull (and thus dropping things that the pipe may eventually only know as weak references) indicates lack of interest.

chrysn avatar Nov 29 '23 19:11 chrysn