1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merge revision(s) f91879a7b5: [Backport #15992]

handle_interrupt to defend monitor state [Bug #15992]

	If an exception is raised from another thread for example Timeout
	and this thread is just after `mon_exit`'s `@mon_owner = nil`,
	the exception breaks the state of MonitorMixin. To prevent that situation,
	it need to block interruption in mon_enter and mon_exit.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67742 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nagachika 2019-08-18 04:32:59 +00:00
parent ad6ffac7d6
commit 9ab43c7a6c
2 changed files with 6 additions and 4 deletions

View file

@ -225,11 +225,13 @@ module MonitorMixin
# +MonitorMixin+.
#
def mon_synchronize
mon_enter
# Prevent interrupt on handling interrupts; for example timeout errors
# it may break locking state.
Thread.handle_interrupt(Exception => :never){ mon_enter }
begin
yield
ensure
mon_exit
Thread.handle_interrupt(Exception => :never){ mon_exit }
end
end
alias synchronize mon_synchronize

View file

@ -1,10 +1,10 @@
#define RUBY_VERSION "2.6.3"
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
#define RUBY_PATCHLEVEL 92
#define RUBY_PATCHLEVEL 93
#define RUBY_RELEASE_YEAR 2019
#define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 11
#define RUBY_RELEASE_DAY 18
#include "ruby/version.h"