rpc: work-around an upstream libevent bug
rpc: work-around an upstream libevent bug

A rare race condition may trigger while awaiting the body of a message, see
upsteam commit 5ff8eb26371c4dc56f384b2de35bea2d87814779 for details.

This may fix some reported rpc hangs/crashes.

Github-Pull: #11593
Rebased-From: 6b58360f9b64eb0b680a662fdfd590e47f115f44

Anfauglith/iop-hd,wangxinxi/litecoin,particl/particl-core,UFOCoins/ufo,Anfauglith/iop-hd,particl/particl-core,romanornr/viacoin,Jcing95/iop-hd,GroestlCoin/bitcoin,wangxinxi/litecoin,BitzenyCoreDevelopers/bitzeny,GroestlCoin/GroestlCoin,GroestlCoin/GroestlCoin,gjhiggins/vcoincore,GroestlCoin/bitcoin,UFOCoins/ufo,digibyte/digibyte,qtumproject/qtum,gjhiggins/vcoincore,Anfauglith/iop-hd,UFOCoins/ufo,BitzenyCoreDevelopers/bitzeny,Jcing95/iop-hd,wangxinxi/litecoin,GroestlCoin/GroestlCoin,romanornr/viacoin,particl/particl-core,wangxinxi/litecoin,romanornr/viacoin,particl/particl-core,gjhiggins/vcoincore,romanornr/viacoin,BitzenyCoreDevelopers/bitzeny,digibyte/digibyte,GroestlCoin/GroestlCoin,gjhiggins/vcoincore,Anfauglith/iop-hd,romanornr/viacoin,wangxinxi/litecoin,tecnovert/particl-core,BitzenyCoreDevelopers/bitzeny,qtumproject/qtum,GroestlCoin/bitcoin,tecnovert/particl-core,tecnovert/particl-core,Jcing95/iop-hd,digibyte/digibyte,tecnovert/particl-core,UFOCoins/ufo,tecnovert/particl-core,digibyte/digibyte,wangxinxi/litecoin,GroestlCoin/GroestlCoin,particl/particl-core,qtumproject/qtum,Jcing95/iop-hd,BitzenyCoreDevelopers/bitzeny,GroestlCoin/bitcoin,digibyte/digibyte,BitzenyCoreDevelopers/bitzeny,qtumproject/qtum,qtumproject/qtum,GroestlCoin/bitcoin,Jcing95/iop-hd,qtumproject/qtum,tecnovert/particl-core,digibyte/digibyte,Anfauglith/iop-hd,UFOCoins/ufo,gjhiggins/vcoincore,romanornr/viacoin,GroestlCoin/GroestlCoin,GroestlCoin/bitcoin,qtumproject/qtum,gjhiggins/vcoincore,Jcing95/iop-hd,UFOCoins/ufo,Anfauglith/iop-hd,particl/particl-core