libqb/lib
Jan Pokorný 97adfa6ba0
IPC: server: avoid temporary channel priority loss, up to deadlock-worth
It turns out that while 7f56f58 allowed for less blocking (thus
throughput increasing) initial handling of connections from clients
within the abstract (out-of-libqb managed) event loop, it unfortunately
subscribes itself back to such polling mechanism for UNIX-socket-check
with a default priority, which can be lower than desired (via explicit
qb_ipcs_request_rate_limit() configuration) for particular channel
(amongst attention-competing siblings in the pool, the term here
refers to associated communication, that is, both server and
on-server abstraction for particular clients).  And priority-based
discrepancies are not forgiven in true priority abiding systems
(that is, unlikele with libqb's native event loop harness as detailed
in the previous commit, for which this would be soft-torelated hence
the problem would not be spotted in the first place -- but that's
expliicitly excluded from further discussion).

On top of that, it violates the natural assumption that once (single
threaded, which is imposed by libqb, at least between initial accept()
and after-said-UNIX-socket-check) server accepts the connection, it
shall rather take care of serving it (at least within stated initial
scope of client connection life cycle) rather than be rushing to accept
new ones -- which is exactly what used to happen previously once the
library user set the effectively priority in the abstract poll
above the default one.

It's conceivable, just as with the former case of attention-competing
siblings with higher priority whereby they could _infinitely_ live on
at the expense of starving the client in the initial handling phase
(authentication) despite the library user's as-high-as-siblings
intention (for using the default priority for that unconditionally
instead, which we address here), the dead lock is imminent also in
this latter accept-to-client-authentication-handling case as well
if there's an _unlimited_ fast-paced arrival queue (well, limited
by with number of allowable open descriptors within the system,
but for the Linux built-in maximum of 1M, there may be no practical
difference, at least for time-sensitive applications).

The only hope then is that such dead-locks are rather theoretical,
since a "spontaneous" constant stream of either communication on
unrelated, higher-prio sibling channels, or of new connection arrivals
can as well testify the poor design of the libqb's IPC application.
That being said, unconditional default priority in the isolated
context of initial server-side client authentication is clearly
a bug, but such application shall apply appropriate rate-limiting
measures (exactly on priority basis) to handle unexpected flux
nonetheless.

The fix makes test_ipc_dispatch_*_glib_prio_deadlock_provoke tests pass.

Signed-off-by: Jan Pokorný <jpokorny@redhat.com>
2019-06-05 10:36:55 +02:00
..
.gitignore Cleanup the .gitignore files 2012-05-09 21:43:58 +10:00
array.c doc: qbarray: reword comment about index partitioning 2019-05-07 14:46:02 +01:00
atomic_int.h Add internal support for the new __atomic gcc builtins 2013-05-13 10:15:55 +10:00
hashtable.c Add the processing which remove notifier at skiplist_destroy function 2013-01-15 01:57:29 +09:00
hdb.c warnings cleanup: Wsign-compare: hdb: uint32_t <-> int32_t 2017-12-20 22:19:17 +01:00
ipc_int.h ipc: Use mkdtemp for more secure IPC files 2019-04-08 16:24:19 +01:00
ipc_setup.c IPC: server: avoid temporary channel priority loss, up to deadlock-worth 2019-06-05 10:36:55 +02:00
ipc_shm.c ipc: Use mkdtemp for more secure IPC files 2019-04-08 16:24:19 +01:00
ipc_socket.c ipc: Use mkdtemp for more secure IPC files 2019-04-08 16:24:19 +01:00
ipcc.c Doc tweaking (#261) 2017-07-20 15:21:51 +01:00
ipcs.c ipc: Use mkdtemp for more secure IPC files 2019-04-08 16:24:19 +01:00
libqb.pc.in Add Pthreads (and possibly other) flags to the pkg-config file (#332) 2018-12-13 08:25:57 +00:00
log_blackbox.c ipc: fixes 2019-04-08 13:18:34 +01:00
log_dcs.c LOG: copy the function/filename for dynamic callsites 2013-03-20 17:10:35 +11:00
log_file.c Add the option of hi-res (millisecond) timestamps (#329) 2018-11-09 09:56:44 +00:00
log_format.c Add the option of hi-res (millisecond) timestamps (#329) 2018-11-09 09:56:44 +00:00
log_int.h Add the option of hi-res (millisecond) timestamps (#329) 2018-11-09 09:56:44 +00:00
log_syslog.c Add the option of hi-res (millisecond) timestamps (#329) 2018-11-09 09:56:44 +00:00
log_thread.c Add the option of hi-res (millisecond) timestamps (#329) 2018-11-09 09:56:44 +00:00
log.c log: Remove more dead code from linker callsites (#331) 2018-11-12 15:55:33 +00:00
loop_int.h LOOP: make it possible to pass in NULL as the default loop instance 2012-02-10 14:47:49 +11:00
loop_job.c Unify the list processing with qb_list function 2013-01-09 02:04:20 +09:00
loop_poll_epoll.c maint: replace 0xffffffff constants with UNIT32_MAX 2017-12-20 22:17:07 +01:00
loop_poll_int.h POLL: seperate out the poll/epoll and add kqueue 2012-04-04 00:26:20 +10:00
loop_poll_kqueue.c The udata member of the kevent struct is a void * 2015-01-23 01:58:02 +01:00
loop_poll_poll.c POLL: seperate out the poll/epoll and add kqueue 2012-04-04 00:26:20 +10:00
loop_poll.c maint: replace 0xffffffff constants with UNIT32_MAX 2017-12-20 22:17:07 +01:00
loop_timerlist.c warnings cleanup: hdb+loop_timerlist: Wsign-compare: (canary?) variables 2017-12-20 22:17:29 +01:00
loop.c Low: loop: don't bring runtime down for a trivial API misuse 2017-06-06 14:04:46 +01:00
Makefile.am Add the option of hi-res (millisecond) timestamps (#329) 2018-11-09 09:56:44 +00:00
map_int.h PTRIE: refcount the notifier structs 2012-01-25 16:09:32 +11:00
map.c MAP: add a notifier purely to allow the user to free memory. 2011-12-14 00:26:01 +11:00
qblog_script_noop.ld High: bare fix for libqb logging not working with ld.bfd/binutils 2.29+ 2017-12-12 23:23:35 +01:00
qblog_script.la.in High: bare fix for libqb logging not working with ld.bfd/binutils 2.29+ 2017-12-12 23:23:35 +01:00
qblog_script.ld.in High: bare fix for libqb logging not working with ld.bfd/binutils 2.29+ 2017-12-12 23:23:35 +01:00
ringbuffer_helper.c Med: rb: use new qb_rb_close_helper able to resort to file truncating 2016-11-04 19:05:35 +01:00
ringbuffer_int.h Med: rb: use new qb_rb_close_helper able to resort to file truncating 2016-11-04 19:05:35 +01:00
ringbuffer.c ipc: Use mkdtemp for more secure IPC files 2019-04-08 16:24:19 +01:00
rpl_sem.c rpl_sem: make destroy more compliant 2013-02-19 12:40:06 +11:00
rpl_sem.h rpl_sem: make destroy more compliant 2013-02-19 12:40:06 +11:00
skiplist.c skiplist: Fix previous skiplist fix 2018-12-12 16:17:59 +01:00
strchrnul.c Use safer versions of string functions (strcpy -> strlcpy) 2012-02-08 22:00:49 +11:00
strlcat.c Fix strlcpy and strlcat functions 2012-12-19 10:42:08 +11:00
strlcpy.c Fix strlcpy and strlcat functions 2012-12-19 10:42:08 +11:00
trie.c warnings cleanup: Wformat: sign-correct PRIu32 specifiers as appropriate 2017-12-21 01:50:15 +01:00
unix.c ipc: Use mkdtemp for more secure IPC files 2019-04-08 16:24:19 +01:00
util_int.h Fix typos: in{ -> s}tance, d{e -> i}stinguished 2017-06-06 14:04:46 +01:00
util.c Low: fix internal object symbol's leak & expose run-time lib version 2017-12-12 23:23:46 +01:00