Eric Blake 848a3b1d5b tests: avoid segfault if json monitor not present
On a machine without yajl headers, I was seeing random segfaults
from qemumonitorjsontest (about 90% of the runs on my particular
machine).  The segfault was inside virClassIsDerivedFrom, which
points to a case of a race leading to unreferencing a stale
pointer to an object that had already been freed.  I also noticed
that if I got the segfault, I was seeing messages such as:

2013-02-22 16:12:37.504+0000: 19833: error : virNetSocketWriteWire:1361 : Cannot write data: Bad file descriptor

which is also evidence of deferencing a stale pointer.  I traced it
to a race where qemuMonitorTestIO could execute late, after the
main thread had already called qemuMonitorTestFree and called
virNetSocketClose(test->client) but not clearing it out to NULL.
Sure enough, after test->client has been closed, fd is -1, which
causes an attempt to write to the socket to fail, which in turn
triggers the error code of qemuMonitorTestIO that tries to re-close
test->client.

* tests/qemumonitortestutils.c (qemuMonitorTestIO): Don't attempt
to free client again if test already quit.
2013-02-25 17:37:14 -07:00
..
2012-04-02 09:33:54 -06:00
2012-09-17 14:59:37 -04:00
2012-12-21 11:19:50 +00:00
2012-12-21 11:19:49 +00:00
2012-12-21 11:17:13 +00:00
2011-07-11 09:21:37 -06:00
2012-12-21 11:19:49 +00:00
2013-02-12 09:00:15 -07:00
2013-01-17 16:39:10 -07:00
2012-12-21 11:19:50 +00:00