libvirt/src/rpc
Michal Privoznik ace45e67ab virNetDaemonCallInhibit: Call virNetDaemonGotInhibitReply properly
So there are couple of issues here. Firstly, we never unref the
@pendingReply and thus it leaks.

==13279== 144 (72 direct, 72 indirect) bytes in 1 blocks are definitely lost in loss record 1,095 of 1,259
==13279==    at 0x4C2E080: calloc (vg_replace_malloc.c:711)
==13279==    by 0x781FA97: _dbus_pending_call_new_unlocked (in /usr/lib64/libdbus-1.so.3.14.11)
==13279==    by 0x7812A4C: dbus_connection_send_with_reply (in /usr/lib64/libdbus-1.so.3.14.11)
==13279==    by 0x56BEDF3: virNetDaemonCallInhibit (virnetdaemon.c:514)
==13279==    by 0x56BEF18: virNetDaemonAddShutdownInhibition (virnetdaemon.c:536)
==13279==    by 0x12473B: daemonInhibitCallback (libvirtd.c:742)
==13279==    by 0x1249BD: daemonRunStateInit (libvirtd.c:823)
==13279==    by 0x554FBCF: virThreadHelper (virthread.c:206)
==13279==    by 0x8F913D3: start_thread (in /lib64/libpthread-2.23.so)
==13279==    by 0x928DE3C: clone (in /lib64/libc-2.23.so)

Secondly, while we send the message, we are suspended ('cos we're
talking to a UNIX socket).  However, until we are resumed back
again the reply might have came therefore subsequent
dbus_pending_call_set_notify() has no effect and in fact the
virNetDaemonGotInhibitReply() callback is never called. Thirdly,
the dbus_connection_send_with_reply() has really stupid policy
for return values. To cite the man page:

  Returns
      FALSE if no memory, TRUE otherwise.

Yes, that's right. If anything goes wrong and it's not case of
OOM then TRUE is returned, i.e. you're trying to pass FDs and
it's not supported, or you're not connected, or anything else.
Therefore, checking for return value of
dbus_connection_send_with_reply() is not enoguh. We also have to
check if @pendingReply is not NULL before proceeding any further.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2017-08-01 11:37:51 +02:00
..
gendispatch.pl rpc: improve error message for bounds check 2017-07-11 15:16:41 +01:00
genprotocol.pl genprotocol.pl: add darwin to fixup list 2016-11-24 17:17:43 +03:00
gensystemtap.pl build: predictably generate systemtap tapsets (bz 1173641) 2016-01-20 10:26:02 -05:00
virkeepalive.c rpc: fix keep alive timer segfault 2017-04-24 12:19:13 +02:00
virkeepalive.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virkeepaliveprotocol.x Define keepalive protocol 2011-11-24 11:44:08 +01:00
virnetclient.c Introduce VIR_NET_STREAM_HOLE message type 2017-05-18 07:42:13 +02:00
virnetclient.h remote: expose a new libssh transport 2016-11-15 15:50:51 +01:00
virnetclientprogram.c rpc: first allocate the memory and then set the count 2017-06-12 19:11:30 -04:00
virnetclientprogram.h maint: fix up copyright notice inconsistencies 2012-09-20 16:30:55 -06:00
virnetclientstream.c virNetClientStreamQueuePacket: Set st->incomingEOF on the end of stream 2017-06-07 18:00:25 +02:00
virnetclientstream.h Introduce virNetClientStreamRecvHole 2017-05-18 07:42:13 +02:00
virnetdaemon.c virNetDaemonCallInhibit: Call virNetDaemonGotInhibitReply properly 2017-08-01 11:37:51 +02:00
virnetdaemon.h Change virNetDaemonGetServerNames to virNetDaemonGetServers 2016-03-11 12:58:41 +01:00
virnetlibsshsession.c rpc: libssh: allow a NULL known_hosts file 2017-01-11 13:37:24 +01:00
virnetlibsshsession.h libssh_transport: add new libssh-based transport 2016-11-15 15:50:51 +01:00
virnetmessage.c rpc: Double buffer size instead of quadrupling buffer size. 2017-05-26 13:53:31 +01:00
virnetmessage.h rpc: use virNetMessageClearPayload in client 2016-05-05 14:28:19 -04:00
virnetprotocol.x rpc: Bump maximum message size to 32M 2017-05-24 14:02:29 +02:00
virnetsaslcontext.c Ignore SASL deprecation warnings on OS-X 2017-04-19 10:51:51 +01:00
virnetsaslcontext.h build: workaround broken SASL header (again) 2016-03-31 17:36:49 +02:00
virnetserver.c refactoring: Use the return value of virObjectRef directly 2017-04-10 14:49:20 +02:00
virnetserver.h rpc: virnetserver: Rename ClientSetProcessingControls to ClientSetLimits 2016-08-02 14:51:13 +02:00
virnetserverclient.c rpc: serverclient: Add option to suppress errors on EOF 2017-03-17 17:20:22 +01:00
virnetserverclient.h rpc: serverclient: Add option to suppress errors on EOF 2017-03-17 17:20:22 +01:00
virnetservermdns.c Use ATTRIBUTE_FALLTHROUGH 2017-06-12 19:11:30 -04:00
virnetservermdns.h Change file names in comments to match the files they are in 2014-03-10 14:26:04 +01:00
virnetserverprogram.c daemon: Introduce virNetServerProgramSendStreamHole 2017-05-18 07:42:13 +02:00
virnetserverprogram.h daemon: Introduce virNetServerProgramSendStreamHole 2017-05-18 07:42:13 +02:00
virnetserverservice.c rpc: Fix potentially segfaults 2017-02-12 15:02:42 -05:00
virnetserverservice.h rpc: allow selection of TCP address family 2015-06-11 12:11:18 +01:00
virnetsocket.c rpc: socket: Add possibility to suppress errors on read hangup 2017-03-17 17:19:00 +01:00
virnetsocket.h Revert "Prevent more compiler optimization of mockable functions" 2017-07-13 13:07:06 +01:00
virnetsshsession.c build: add GCC 6.0 -Wlogical-op workaround 2016-04-11 12:09:14 +02:00
virnetsshsession.h remote: Improve libssh2 password authentication 2013-07-12 09:22:38 +02:00
virnettlscontext.c Report what TLS priority string we use for a session 2017-03-16 11:03:33 +00:00
virnettlscontext.h rpc: allow priority string to be passed to TLS context 2016-06-08 13:48:45 +01:00