Jansson uses `strtoll` to parse integers, and it explicitly checks for integer overflow . This can only parse signed long longs, but QEMU sometimes produces JSON containing 2^64-1.
# virsh start example --paused
Domain example started
# virsh domstats example
[... some stats, but no error ...]
# virsh resume example
error: Failed to resume domain example
error: internal error: failed to parse JSON 1:59: too big integer near '18446744073709551615'
This wedges the monitor object completely, and no further operations on the VM are possible.
(Although YAJL has the same kind of validation as Jansson, libvirt was avoiding the problem since it would register its own callback to parse numbers.)
Looks like we are pretty doomed - Jansson devs have refused to support unsigned 64-bit ints https://github.com/akheron/jansson/issues/154
AFAICT, there's no way to get the original value as a string in jansson either - it will always parse it :-(
even if we extend the range and say goodbye to precision by using JSON_DECODE_INT_AS_REAL, it will not overflow to -1 which QEMU expects us to do here.
I believe this is solved by my earlier series 'Revert the switch to Jansson':
Yeah, I've looked at the source and there is no "get out of jail free" option here - the parser has no way to expose the number as a string like yajl did.
This looks like a terminal problem with jansson with revert being only option :-(
c-json doesn't look any better in this respect either, also using strtoll
I pointed out years and years ago that JSON integers are fundamentally
Revert of the Jansson switch:
Pushed as of:
Author: Ján Tomko <firstname.lastname@example.org>
CommitDate: 2018-08-13 15:50:01 +0200
Revert "build: add --with-jansson"
git describe: v4.6.0-128-g86db0db979