diff mbox

[ovs-dev,V7,09/16] python tests: Fixed OSError not iterable on Windows

Message ID 1468592469-10160-10-git-send-email-pboca@cloudbasesolutions.com
State Superseded
Delegated to: Guru Shetty
Headers show

Commit Message

Paul Boca July 15, 2016, 2:21 p.m. UTC
On Windows if this exception is triggered then it will raise an exception while in the
exception handler.

Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>
---
V2: No changes
V3: No changes
V4: No changes
V5: No changes
V6: No changes
V7: No changes
---
 python/ovs/poller.py | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Alin Serdean July 21, 2016, 1:11 p.m. UTC | #1
> -----Mesaj original-----

> De la: dev [mailto:dev-bounces@openvswitch.org] În numele Paul Boca

> Trimis: Friday, July 15, 2016 5:21 PM

> Către: dev@openvswitch.org

> Subiect: [ovs-dev] [PATCH V7 09/16] python tests: Fixed OSError not iterable

> on Windows

> 

> On Windows if this exception is triggered then it will raise an exception while

> in the exception handler.

> 

> Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>

>  import select

>  import socket

> +import os

[Alin Gabriel Serdean: ] I don't think you need import os for OSError, so probably it can be removed.
> 

>  try:

>      import eventlet.patcher

> @@ -168,6 +169,10 @@ class Poller(object):

>              try:

>                  events = self.poll.poll(self.timeout)

>                  self.__log_wakeup(events)

> +            except OSError as e:

> +                error = e.errno

> +                if error != errno.EINTR:

> +                    vlog.err("poll: %s" % os.strerror(e.errno))

[Alin Gabriel Serdean: ] As discussed offline you are getting the exception because you have an empty list for the select. I am ok with trying to catch it for the moment but please add a comment so we will know in the future.
>              except select.error as e:

>                  # XXX rate-limit

>                  error, msg = e

> --

> 2.7.2.windows.1

> _______________________________________________

> dev mailing list

> dev@openvswitch.org

> http://openvswitch.org/mailman/listinfo/dev
Paul Boca July 21, 2016, 3:55 p.m. UTC | #2
Hi Alin,

Comments inlined.

Thanks,
Paul

> -----Original Message-----

> From: Alin Serdean

> Sent: Thursday, July 21, 2016 4:11 PM

> To: Paul Boca; dev@openvswitch.org

> Subject: RE: [ovs-dev] [PATCH V7 09/16] python tests: Fixed OSError not

> iterable on Windows

> 

> 

> 

> > -----Mesaj original-----

> > De la: dev [mailto:dev-bounces@openvswitch.org] În numele Paul Boca

> > Trimis: Friday, July 15, 2016 5:21 PM

> > Către: dev@openvswitch.org

> > Subiect: [ovs-dev] [PATCH V7 09/16] python tests: Fixed OSError not

> iterable

> > on Windows

> >

> > On Windows if this exception is triggered then it will raise an exception

> while

> > in the exception handler.

> >

> > Signed-off-by: Paul-Daniel Boca <pboca@cloudbasesolutions.com>

> >  import select

> >  import socket

> > +import os

> [Alin Gabriel Serdean: ] I don't think you need import os for OSError, so

> probably it can be removed.

[Paul Boca] this import is needed for "os.strerror"

> >

> >  try:

> >      import eventlet.patcher

> > @@ -168,6 +169,10 @@ class Poller(object):

> >              try:

> >                  events = self.poll.poll(self.timeout)

> >                  self.__log_wakeup(events)

> > +            except OSError as e:

> > +                error = e.errno

> > +                if error != errno.EINTR:

> > +                    vlog.err("poll: %s" % os.strerror(e.errno))

> [Alin Gabriel Serdean: ] As discussed offline you are getting the exception

> because you have an empty list for the select. I am ok with trying to catch it

> for the moment but please add a comment so we will know in the future.

[Paul Boca] Will add the comment, will be easier that way for someone to
understand what's happening.

> >              except select.error as e:

> >                  # XXX rate-limit

> >                  error, msg = e

> > --

> > 2.7.2.windows.1

> > _______________________________________________

> > dev mailing list

> > dev@openvswitch.org

> > http://openvswitch.org/mailman/listinfo/dev
diff mbox

Patch

diff --git a/python/ovs/poller.py b/python/ovs/poller.py
index 20be801..a0fb2a7 100644
--- a/python/ovs/poller.py
+++ b/python/ovs/poller.py
@@ -17,6 +17,7 @@  import ovs.timeval
 import ovs.vlog
 import select
 import socket
+import os
 
 try:
     import eventlet.patcher
@@ -168,6 +169,10 @@  class Poller(object):
             try:
                 events = self.poll.poll(self.timeout)
                 self.__log_wakeup(events)
+            except OSError as e:
+                error = e.errno
+                if error != errno.EINTR:
+                    vlog.err("poll: %s" % os.strerror(e.errno))
             except select.error as e:
                 # XXX rate-limit
                 error, msg = e