<div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, May 3, 2019 at 7:59 PM Michele Baldessari <<a href="mailto:michele@acksyn.org" target="_blank">michele@acksyn.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Apr 22, 2019 at 01:21:03PM -0500, Ben Nemec wrote:<br>
> <br>
> <br>
> On 4/22/19 12:53 PM, Alex Schultz wrote:<br>
> > On Mon, Apr 22, 2019 at 11:28 AM Ben Nemec <<a href="mailto:openstack@nemebean.com" target="_blank">openstack@nemebean.com</a>> wrote:<br>
> > > <br>
> > > <br>
> > > <br>
> > > On 4/20/19 1:38 AM, Michele Baldessari wrote:<br>
> > > > On Fri, Apr 19, 2019 at 03:20:44PM -0700, <a href="mailto:iain.macdonnell@oracle.com" target="_blank">iain.macdonnell@oracle.com</a> wrote:<br>
> > > > > <br>
> > > > > Today I discovered that this problem appears to be caused by eventlet<br>
> > > > > monkey-patching. I've created a bug for it:<br>
> > > > > <br>
> > > > > <a href="https://bugs.launchpad.net/nova/+bug/1825584" rel="noreferrer" target="_blank">https://bugs.launchpad.net/nova/+bug/1825584</a><br>
> > > > <br>
> > > > Hi,<br>
> > > > <br>
> > > > just for completeness we see this very same issue also with<br>
> > > > mistral (actually it was the first service where we noticed the missed<br>
> > > > heartbeats). iirc Alex Schultz mentioned seeing it in ironic as well,<br>
> > > > although I have not personally observed it there yet.<br>
> > > <br>
> > > Is Mistral also mixing eventlet monkeypatching and WSGI?<br>
> > > <br>
> > <br>
> > Looks like there is monkey patching, however we noticed it with the<br>
> > engine/executor. So it's likely not just wsgi.  I think I also saw it<br>
> > in the ironic-conductor, though I'd have to try it out again.  I'll<br>
> > spin up an undercloud today and see if I can get a more complete list<br>
> > of affected services. It was pretty easy to reproduce.<br>
> <br>
> Okay, I asked because if there's no WSGI/Eventlet combination then this may<br>
> be different from the Nova issue that prompted this thread. It sounds like<br>
> that was being caused by a bad interaction between WSGI and some Eventlet<br>
> timers. If there's no WSGI involved then I wouldn't expect that to happen.<br>
> <br>
> I guess we'll see what further investigation turns up, but based on the<br>
> preliminary information there may be two bugs here.<br>
<br>
So just to get some closure on this error that we have seen around<br>
mistral executor and tripleo with python3: this was due to the ansible<br>
action that called subprocess which has a different implementation in<br>
python3 and so the monkeypatching needs to be adapted.<br>
<br>
Review which fixes it for us is here: <a href="https://review.opendev.org/#/c/656901/" rel="noreferrer" target="_blank">https://review.opendev.org/#/c/656901/</a><br>
<br>
Damien and I think the nova_api/eventlet/mod_wsgi has a separate root-cause<br>
(although we have not spent all too much time on that one yet)<br>
<br></blockquote><div><br></div><div>Right, after further investigation, it appears that the problem we saw<br>under mod_wsgi was due to monkey patching, as Iain originally<br>reported. It has nothing to do with our work on healthchecks.<br><br>It turns out that running the AMQP heartbeat thread under mod_wsgi<br>doesn't work when the threading library is monkey_patched, because the<br>thread waits on a data structure [1] that has been monkey patched [2],<br>which makes it yield its execution instead of sleeping for 15s.<br><br>Because mod_wsgi stops the execution of its embedded interpreter, the<br>AMQP heartbeat thread can't be resumed until there's a message to be<br>processed in the mod_wsgi queue, which would resume the python<br>interpreter and make eventlet resume the thread.<br><br>Disabling monkey-patching in nova_api makes the scheduling issue go<br>away.<br><br>Note: other services like heat-api do not use monkey patching and<br>aren't affected, so this seem to confirm that monkey-patching<br>shouldn't happen in nova_api running under mod_wsgi in the first<br>place.<br><br>[1] <a href="https://github.com/openstack/oslo.messaging/blob/master/oslo_messaging/_drivers/impl_rabbit.py#L904">https://github.com/openstack/oslo.messaging/blob/master/oslo_messaging/_drivers/impl_rabbit.py#L904</a><br>[2] <a href="https://github.com/openstack/oslo.utils/blob/master/oslo_utils/eventletutils.py#L182">https://github.com/openstack/oslo.utils/blob/master/oslo_utils/eventletutils.py#L182</a></div></div></div></div>