New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cli: ignore EINTR caused by SIGWINCH when calling poll() #847

Merged
merged 1 commit into from Dec 20, 2018

Conversation

Projects
None yet
2 participants
@yousong
Copy link
Contributor

yousong commented Dec 13, 2018

This can happen when adjusting a tmux pane running mininet cli. The
process will receive SIGWINCH causing the poll() call to raise
select.error

Below is a session dump with strace

09:55:52.498106 poll([{fd=0, events=POLLIN}, {fd=28, events=POLLIN}], 2, -1) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
09:55:52.606734 --- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
09:55:52.606770 rt_sigreturn({mask=[]}) = -1 EINTR (Interrupted system call)
Traceback (most recent call last):
  File "examples/topofac.py", line 527, in <module>
    run()
  File "examples/topofac.py", line 522, in run
    CLI( net )
  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 68, in __init__
    self.run()
  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 103, in run
    self.cmdloop()
  File "/home/yunion/.usr/lib/python2.7/cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "/home/yunion/.usr/lib/python2.7/cmd.py", line 220, in onecmd
    return self.default(line)
  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 422, in default
    self.waitForNode( node )
  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 440, in waitForNode
    bothPoller.poll()
select.error: (4, 'Interrupted system call')
09:55:52.622076 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7ff9a9b936d0}, {0x7ff9a9ef2230, [], SA_RESTORER, 0x7ff9a9b936d0}, 8) = 0
09:55:52.631905 +++ exited with 1 +++

@yousong yousong force-pushed the yousong:poll-eintr branch 3 times, most recently from 3e5204e to 670b0e6 Dec 13, 2018

@yousong

This comment has been minimized.

Copy link
Contributor

yousong commented Dec 13, 2018

v2 <- v1 Disable pylint check unpacking-non-sequence for the line unpacking select.error

@lantz

This comment has been minimized.

Copy link
Member

lantz commented Dec 13, 2018

Could you remove the unnecessary changes caused by deleting from select import ... ?

@@ -28,7 +28,8 @@
from subprocess import call
from cmd import Cmd
from os import isatty
from select import poll, POLLIN

This comment has been minimized.

@lantz

lantz Dec 13, 2018

Member

There is no reason to delete this. Better to preserve the style of the code and add the additional things you need.

cli: ignore EINTR caused by SIGWINCH when calling poll()
This can happen when adjusting a tmux pane running mininet cli.  The
process will receive SIGWINCH causing the poll() call to raise
select.error

Below is a session dump with strace

	09:55:52.498106 poll([{fd=0, events=POLLIN}, {fd=28, events=POLLIN}], 2, -1) = ? ERESTART_RESTARTBLOCK (Interrupted by signal)
	09:55:52.606734 --- SIGWINCH {si_signo=SIGWINCH, si_code=SI_KERNEL} ---
	09:55:52.606770 rt_sigreturn({mask=[]}) = -1 EINTR (Interrupted system call)
	Traceback (most recent call last):
	  File "examples/topofac.py", line 527, in <module>
	    run()
	  File "examples/topofac.py", line 522, in run
	    CLI( net )
	  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 68, in __init__
	    self.run()
	  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 103, in run
	    self.cmdloop()
	  File "/home/yunion/.usr/lib/python2.7/cmd.py", line 142, in cmdloop
	    stop = self.onecmd(line)
	  File "/home/yunion/.usr/lib/python2.7/cmd.py", line 220, in onecmd
	    return self.default(line)
	  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 422, in default
	    self.waitForNode( node )
	  File "/home/yunion/git-repo/mininet/mininet/cli.py", line 440, in waitForNode
	    bothPoller.poll()
	select.error: (4, 'Interrupted system call')
	09:55:52.622076 rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7ff9a9b936d0}, {0x7ff9a9ef2230, [], SA_RESTORER, 0x7ff9a9b936d0}, 8) = 0
	09:55:52.631905 +++ exited with 1 +++

@yousong yousong force-pushed the yousong:poll-eintr branch from 670b0e6 to f170cc6 Dec 14, 2018

@yousong

This comment has been minimized.

Copy link
Contributor

yousong commented Dec 14, 2018

v3 <- v2 import select without touching from select import xx

@lantz lantz merged commit cf6da39 into mininet:master Dec 20, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@lantz

This comment has been minimized.

Copy link
Member

lantz commented Dec 20, 2018

Great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment