[issue31687] test_semaphore_tracker() of test_multiprocessing_spawn fails randomly (race condition?)

2017-11-30 Thread stevezh

stevezh <cisji...@gmail.com> added the comment:

It maybe the semaphore tracker process doesn't unlink the semaphore as soon as 
possible when child process exit when the system is slow. Increase test case's 
time in the child and before assertRaises will help.

--
nosy: +stevezh

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



[issue32014] multiprocessing Server's shutdown method useless send message to manager

2017-11-12 Thread stevezh

New submission from stevezh <cisji...@gmail.com>:

When shutdown the manager, Server's handle_request will send back message to 
the manager, so is useless for the Server's shutdown method send back "None" to 
the manager?

Source code from Lib/multiprocessing/managers.py:

def shutdown(self, c):
'''
Shutdown this process
'''
try:
util.debug('manager received shutdown message')
# Is useless here?
c.send(('#RETURN', None))
except:
import traceback
traceback.print_exc()
finally:
self.stop_event.set()

Server's handle_request may throw and catch exception because the conn is 
closed in _finalize_manager() after Server's shutdown method returns.

code from handle_request():

try:
c.send(msg)
except Exception as e:
try:
c.send(('#TRACEBACK', format_exc()))
except Exception:
pass

code from _finalize_manager():

try:
conn = _Client(address, authkey=authkey)
try:
dispatch(conn, None, 'shutdown')
finally:
conn.close()
except Exception:
pass

Also the Server's shutdown method only used by manager class.

--
components: Library (Lib)
messages: 306142
nosy: davin, jnoller, pitrou, sbt, stevezh
priority: normal
severity: normal
status: open
title: multiprocessing Server's shutdown method useless send message to manager
type: behavior
versions: Python 3.5, Python 3.6

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