[issue20513] Script interruption on logoff from 0 session under Win2003 and earlier

2014-02-04 Thread Victor Scherba

New submission from Victor Scherba:

To get the bug:
1. Windows Server 2003 (same bug should be under earlier versions: XP, 2000, 
...).
2. Any Windows service should spawn process with Python script.
3. Py script should stay into time.sleep.
4. Any Windows user should login in console session 0.
5. Bug: when this user logoff, script interrupts.

To repeat the bug simply you could use srvany which spawn: python.exe -c 
import time; time.sleep(1).

There is problem in cpython/Modules/timemodule.c in PyCtrlHandler.
Before logoff Windows broadcasts to all services and its children 
CTRL_LOGOFF_EVENT signal. But PyCtrlHandler doesn't filter it out by dwCtrlType 
and always sets hInterruptEvent. This forces script interruption.

CTRL_SHUTDOWN_EVENT also should be filtered out. CTRL_SHUTDOWN_EVENT broacasted 
to all services before Windows shutdown. But after it has been handled, other 
process can block or pause shutdowning.

Default Windows console control handler does not call ExitProcess when 
processing the CTRL_LOGOFF_EVENT and CTRL_SHUTDOWN_EVENT signals. See more at 
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683242(v=vs.85).aspx

On Win Vista and higher bug not presents. Impossible to login to session 0 
because of session 0 isolation.

Patch attached. There is same fix in 
cpython/Modules/_multiprocessing/multiprocessing.c

--
components: Extension Modules, Windows
messages: 210259
nosy: vScherba
priority: normal
severity: normal
status: open
title: Script interruption on logoff from 0 session under Win2003 and earlier
type: behavior
versions: Python 2.7

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20513
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20513] Script interruption on logoff from 0 session under Win2003 and earlier

2014-02-04 Thread Victor Scherba

Changes by Victor Scherba vic.sche...@gmail.com:


Removed file: http://bugs.python.org/file33915/ConsoleCtrlHandler.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20513
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20513] Script interruption on logoff from 0 session under Win2003 and earlier

2014-02-04 Thread Victor Scherba

Changes by Victor Scherba vic.sche...@gmail.com:


Added file: http://bugs.python.org/file33915/ConsoleCtrlHandler.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20513
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20513] Script interruption on logoff from 0 session under Win2003 and earlier

2014-02-04 Thread Victor Scherba

Changes by Victor Scherba vic.sche...@gmail.com:


--
keywords: +patch
Added file: http://bugs.python.org/file33915/ConsoleCtrlHandler.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20513
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue20513] Python 2.7. Script interruption on logoff from 0 session under Win2003 and earlier

2014-02-04 Thread Victor Scherba

Changes by Victor Scherba vic.sche...@gmail.com:


--
title: Script interruption on logoff from 0 session under Win2003 and earlier 
- Python 2.7. Script interruption on logoff from 0 session under Win2003 and 
earlier

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20513
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com