= Description =

## Please read this page. Lines prefixed with ## such as this one are comments,
## you can remove them (except for those after the "Plan" section.)
## Please follow the instructions given in those comments and the text.
## After creating the bug page, please subscribe to it! We may have questions
## that only you can answer, and if you get email when your bug changes it'll
## be much faster to get it fixed since you can answer the questions!

When I press <Ctrl-C> to close MoinMoin Desktop Edition, it generates a traceback, complaining of ''select.error: (4, 'Interrupted system call')''.

== Steps to reproduce ==
## Describe the steps needed to reproduce the bug. If we can't reproduce it, we  probably can't fix it.
 1. Start with a Mac running OS X 10.4.11.
 1. Install [[http://www.python.org/ftp/python/2.6.1/python-2.6.1-macosx2008-12-06.dmg|Python 2.6.1 from www.python.org]].
 1. Install MoinMoin 1.8.2.
 1. Launch MoinMoin from Terminal.app command line
 1. Press <Ctrl-c> to close MoinMoin.

== Example ==

== Component selection ==

## Where you think is this bug happening ? (general, plugin [plugin name], theme [theme name], ...

 * general

== Details ==

## If you got a traceback, please save the traceback page as html and attach here:
## [[attachment:traceback.html]]

## if the bug is in this wiki, just kill the table and write: This Wiki.

## If a traceback is not available, please fill in the details here:
|| '''!MoinMoin Version''' || 1.8.2 ||
|| '''OS and Version''' || OS X 10.4.11 Intel ||
|| '''Python Version''' || 2.6.1 from www.python.org ||
|| '''Server Setup''' || none ||
|| '''Server Details''' || none ||
|| '''Language you are using the wiki in''' (set in the browser/UserPreferences) || ''<Browser setting>''. If it matters, I am using Safari 3.2.1, with Safari's default encoding set to ''Western (ISO Latin 1)''. ||

Transcripts from Terminal.app follow.

The first one shows the build of Python used.
 {{{
Mac:~/Desktop/moin-1.8.2 username$ echo $PATH
/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin
Mac:~/Desktop/moin-1.8.2 username$ which python
/usr/local/bin/python
Mac:~/Desktop/moin-1.8.2 username$ python
Python 2.6.1 (r261:67515, Dec  6 2008, 16:42:21)
[GCC 4.0.1 (Apple Computer, Inc. build 5370)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
}}}

The second one shows exactly what happens when launching MoinMoin from Terminal.app using the above-mentioned build of Python.
 {{{
Mac:~/Desktop/moin-1.8.2 username$ python wikiserver.py
2009-03-25 20:19:23,111 INFO MoinMoin.log:126 using logging configuration read from "/Users/username/Desktop/moin-1.8.2/wikiserverlogging.conf"
2009-03-25 20:19:23,315 INFO MoinMoin.server.server_standalone:72 ThreadPoolServer serving on 127.0.0.1:8080
^C2009-03-25 20:19:25,422 INFO MoinMoin.server.server_standalone:491 Thanks for using MoinMoin!
Traceback (most recent call last):
  File "wikiserver.py", line 38, in <module>
    MoinScript().run()
  File "/Users/davidbiovision/Desktop/moin-1.8.2/MoinMoin/script/__init__.py", line 138, in run
    self.mainloop()
  File "/Users/davidbiovision/Desktop/moin-1.8.2/MoinMoin/script/__init__.py", line 255, in mainloop
    plugin_class(args[2:], self.options).run() # all starts again there
  File "/Users/davidbiovision/Desktop/moin-1.8.2/MoinMoin/script/__init__.py", line 138, in run
    self.mainloop()
  File "/Users/davidbiovision/Desktop/moin-1.8.2/MoinMoin/script/server/standalone.py", line 131, in mainloop
    run(Config)
  File "/Users/davidbiovision/Desktop/moin-1.8.2/MoinMoin/server/server_standalone.py", line 638, in run
    httpd.serve_forever()
  File "/Users/davidbiovision/Desktop/moin-1.8.2/MoinMoin/server/server_standalone.py", line 189, in serve_forever
    SimpleServer.serve_forever(self)
  File "/Users/davidbiovision/Desktop/moin-1.8.2/MoinMoin/server/server_standalone.py", line 77, in serve_forever
    self.handle_request()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/SocketServer.py", line 262, in handle_request
    fd_sets = select.select([self], [], [], timeout)
select.error: (4, 'Interrupted system call')
Mac:~/Desktop/moin-1.8.2 username$
}}}

== Workaround ==
## How to deal with the bug until it is fixed


= Discussion =

[[http://bugs.python.org/issue7978|Python issue 7978]] ("!SocketServer doesn't handle syscall interruption") may be the cause of this. [[http://thread.gmane.org/gmane.comp.python.devel/112365/focus=112366| A thread on Python-dev]] discusses it. 

From Python issue 7978:

 !SocketServer's handle_request function uses "select" call to handle io, but sending POSIX signal will result in 'Interrupted system call' exception raised. After that Paste (http://pythonpaste.org/) http server will crash.

 I suppose EINTR must be handled properly (i.e. syscall must be restarted silently) on !SocketServer's side. That must be pretty easy task. . . .
 
 . Wrapping select in (taken from twisted sources) can help:
{{{
def untilConcludes(f, *a, **kw):
    while True:
        try:
            return f(*a, **kw)
        except (IOError, OSError), e:
            if e.args[0] == errno.EINTR:
                continue
            raise
}}}


The bug may also happen in 1.8.7 I am not sure about this. But please for many reasons (SecurityFixes) please do this update to 1.8.7. {{attachment:ReimarBauer/Photo/img.png}} -- ReimarBauer <<DateTime(2010-04-08T21:02:15+0100)>>

= Plan =
## This part is for Moin``Moin developers:

 * Priority:
 * Assigned to:
 * Status:

----
## If you are a moin core developer, replace the category to Category* in these cases:
## Category MoinMoinNoBug - if this is not a bug.
## Category MoinMoinBugConfirmed - if you can confirm the bug on current code.
## Category MoinMoinBugFixed - after the bug is fixed in current code.
CategoryMoinMoinBug