Skip to content
Commit 2001d7ad authored by Philip Withnall's avatar Philip Withnall 🚫
Browse files

core: Rate-limit AvatarCache.store_avatar() to prevent FD exhaustion

If connecting to a new EDS address book, or doing something else which
may cause a torrent of AvatarCache.store_avatar() calls, it is possible
to hit the operating system’s file descriptor limit, which causes
further store operations to fail.

Implement a simple FIFO rate limit on concurrent
AvatarCache.store_avatar() calls to try and ensure this won’t happen. It
is still possible if the process calls store_avatar() several times
while already near the FD limit, but then failure is pretty inevitable
anyway, and is already handled gracefully.

The changes are implemented in a self-contained wrapper function around
store_avatar(), and only result in memory allocations in the queueing
case.

A test case is included. This does not affect the AvatarCache API or
ABI.

https://bugzilla.gnome.org/show_bug.cgi?id=705742
parent 12b7985e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment