openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #07013
[Merge] lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep into lp:ocb-server
Ronald Portier (Therp) has proposed merging lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep into lp:ocb-server.
Requested reviews:
OpenERP Community Backports (ocb)
Related bugs:
Bug #1298258 in OpenERP Community Backports (Server): "Log filled with "join and sleep" messages."
https://bugs.launchpad.net/ocb-server/+bug/1298258
For more details, see:
https://code.launchpad.net/~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep/+merge/221357
Prevent log from filling up with messages when there are difficulties ending all threads on server stop.
--
https://code.launchpad.net/~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep/+merge/221357
Your team OpenERP Community Backports is requested to review the proposed merge of lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep into lp:ocb-server.
=== modified file 'openerp/service/__init__.py'
--- openerp/service/__init__.py 2013-11-25 10:38:42 +0000
+++ openerp/service/__init__.py 2014-05-29 11:14:34 +0000
@@ -94,6 +94,14 @@
# Start the main cron thread.
cron.start_service()
+def log_repeating_message(msg, counter):
+ '''Utility function to log repeated messages, withouth overflowing log'''
+ if (counter <= 10
+ or (counter <= 100 and (counter % 10 == 0))
+ or (counter <= 1000 and (counter % 100 == 0))
+ or (counter > 1999 and (counter % 1000 == 0))):
+ _logger.debug('%d: %s' % (counter, msg))
+
def stop_services():
""" Stop all services. """
# stop services
@@ -112,8 +120,11 @@
for thread in threading.enumerate():
_logger.debug('process %r (%r)', thread, thread.isDaemon())
if thread != me and not thread.isDaemon() and thread.ident != main_thread_id:
+ msg_counter = 0
+ msg = 'join and sleep %s' % thread.name
while thread.isAlive():
- _logger.debug('join and sleep')
+ msg_counter += 1
+ log_repeating_message(msg, msg_counter)
# Need a busyloop here as thread.join() masks signals
# and would prevent the forced shutdown.
thread.join(0.05)
Follow ups