[PATCH 20/33] Don't report OOM error on xmlCopyNode failure

Peter Krempa pkrempa at redhat.com
Mon Mar 1 15:16:06 UTC 2021


On Wed, Feb 24, 2021 at 22:25:56 -0500, Laine Stump wrote:
> On 2/24/21 11:16 AM, Peter Krempa wrote:
> > Out of memory isn't the only reason the function can fail. Add a message
> > stating that copying of a XML node failed.
> 
> Could it still fail due to OOM as well, though? And if so, is there any way
> of differentiating? (I previously looked into this for some other libxml2
> function, ended up asking DV, and I believe I was told that there isn't any
> way to tell the difference, but as usual IMBES (I May Be Experiencing
> Senility).

Yes, it's one of the options.

> At any rate, your changed message is more correct, since it's not making any
> unsubstantiated assumption about the cause of the error, while
> virRemoveOOMError() was).

I tried to formulate them such that they will be true even in OOM case
by making them as vague as the description of the error reported by the
API is.

In case of OOM though, if the OOM condition persists, the logging call
will abort() anyways right when it's called, so in all but the very
rarest cases we'd report the correct error.




More information about the libvir-list mailing list