Merge lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep into lp:ocb-server

Proposed by Ronald Portier (Therp)
Status: Rejected
Rejected by: Holger Brunn (Therp)
Proposed branch: lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep
Merge into: lp:ocb-server
Diff against target: 31 lines (+12/-1)
1 file modified
openerp/service/__init__.py (+12/-1)
To merge this branch: bzr merge lp:~therp-nl/ocb-server/7.0_lp1298258_join_and_sleep
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Disapprove
Review via email: mp+221357@code.launchpad.net

Description of the change

Prevent log from filling up with messages when there are difficulties ending all threads on server stop.

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Development for 7.0 has moved to github on https://github.com/OCA/ocb - please move your merge proposal there if it is still valid.

(I close and reject this in order to have a cleaner overview for 6.1 MPs which indeed have to be done on launchpad)

review: Disapprove

Unmerged revisions

5344. By Ronald Portier (Therp)

[FIX] Prevent filling up log with messages when there are difficulties
    ending all threads on server stop.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== 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 @@
94 # Start the main cron thread.94 # Start the main cron thread.
95 cron.start_service()95 cron.start_service()
9696
97def log_repeating_message(msg, counter):
98 '''Utility function to log repeated messages, withouth overflowing log'''
99 if (counter <= 10
100 or (counter <= 100 and (counter % 10 == 0))
101 or (counter <= 1000 and (counter % 100 == 0))
102 or (counter > 1999 and (counter % 1000 == 0))):
103 _logger.debug('%d: %s' % (counter, msg))
104
97def stop_services():105def stop_services():
98 """ Stop all services. """106 """ Stop all services. """
99 # stop services107 # stop services
@@ -112,8 +120,11 @@
112 for thread in threading.enumerate():120 for thread in threading.enumerate():
113 _logger.debug('process %r (%r)', thread, thread.isDaemon())121 _logger.debug('process %r (%r)', thread, thread.isDaemon())
114 if thread != me and not thread.isDaemon() and thread.ident != main_thread_id:122 if thread != me and not thread.isDaemon() and thread.ident != main_thread_id:
123 msg_counter = 0
124 msg = 'join and sleep %s' % thread.name
115 while thread.isAlive():125 while thread.isAlive():
116 _logger.debug('join and sleep')126 msg_counter += 1
127 log_repeating_message(msg, msg_counter)
117 # Need a busyloop here as thread.join() masks signals128 # Need a busyloop here as thread.join() masks signals
118 # and would prevent the forced shutdown.129 # and would prevent the forced shutdown.
119 thread.join(0.05)130 thread.join(0.05)

Subscribers

People subscribed via source and target branches

to status/vote changes: