Skip to content

keepalive: a ping that missed and re-wrote the cache does not restart the ttl_expiry clock #580

Open

Description

@amiddavid

Summary

A keep-alive ping that missed the cache does not move the entry's refresh time. The next miss can then get the verdict ttl_expiry (the cache lifetime ran out) when the cache was in fact re-created by that ping. Found by Osher in the review of #546 (finding 4).

What we found

  • proxy/keepalive.go:1538 and :1776 move the refresh time only for a ping that read the cache (CacheRead > 0).
  • A ping that missed also wrote the entry again, so the cache lifetime started again at that ping.
  • The next request that misses is then judged against the older refresh time, and the dashboard shows ttl_expiry.
  • This is rare at the default 270 s idle setting.

Proposal

  1. Move the refresh time for a ping that wrote the cache (CacheWrite > 0) as well as one that read it.
  2. Add a test: a ping that misses and writes, then a request after the lifetime from the first request but within the lifetime from the ping. The verdict must not be ttl_expiry.

Reference: #546 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions