Pull upstream patch (under review) for ruby filer deadlock treatment

This commit is contained in:
Mamoru TASAKA 2022-12-02 10:47:14 +09:00
parent 75c9b97e48
commit 923bde85ab
2 changed files with 52 additions and 1 deletions

View File

@ -0,0 +1,43 @@
From 5de969f09c60fb46b75c0df0a227d8b0a60d3b95 Mon Sep 17 00:00:00 2001
From: ojab <ojab@ojab.ru>
Date: Fri, 18 Nov 2022 15:12:19 +0000
Subject: [PATCH] Fix `ReentrantMutex` locking inside `Fiber` spec for ruby-3.2
It raises `ThreadError` since https://github.com/ruby/ruby/pull/6680
---
spec/rspec/support/reentrant_mutex_spec.rb | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/spec/rspec/support/reentrant_mutex_spec.rb b/spec/rspec/support/reentrant_mutex_spec.rb
index 9bef54ee..34c2b27c 100644
--- a/spec/rspec/support/reentrant_mutex_spec.rb
+++ b/spec/rspec/support/reentrant_mutex_spec.rb
@@ -28,7 +28,18 @@
order.join_all
end
- if RUBY_VERSION >= '3.0'
+ if RUBY_VERSION >= '3.1.3'
+ it 'raises an error when trying to lock from another Fiber' do
+ mutex.synchronize do
+ Fiber.new do
+ expect {
+ mutex.send(:enter)
+ raise 'should not reach here: mutex is already locked on different Fiber'
+ }.to raise_error(ThreadError, 'deadlock; lock already owned by another fiber belonging to the same thread')
+ end.resume
+ end
+ end
+ elsif RUBY_VERSION >= '3.0'
it 'waits when trying to lock from another Fiber' do
mutex.synchronize do
ready = false
@@ -36,7 +47,7 @@
expect {
ready = true
mutex.send(:enter)
- raise 'should reach here: mutex is already locked on different Fiber'
+ raise 'should not reach here: mutex is already locked on different Fiber'
}.to raise_error(Exception, 'waited correctly')
end

View File

@ -3,7 +3,7 @@
%global mainver 3.12.0
%undefine prever
%global mainrel 1
%global mainrel 2
%global prerpmver %(echo "%{?prever}" | sed -e 's|\\.||g')
%bcond_with bootstrap
@ -21,6 +21,10 @@ Source0: https://rubygems.org/gems/%{gem_name}-%{mainver}%{?prever}.gem
# %%{SOURCE2} %%{name} %%{version}
Source1: rubygem-%{gem_name}-%{version}-full.tar.gz
Source2: rspec-related-create-full-tarball.sh
# https://github.com/rspec/rspec-support/pull/553
# ruby 3.2.0 / 3.1.3 changes fiber deadlock treatment
# Tweaked for ruby 3.1.3
Patch0: rubygem-rspec-support-3.12.0-ReentrantMutex-insider-Fiber.patch
# tweak regex for search path
Patch100: rubygem-rspec-support-3.2.1-callerfilter-searchpath-regex.patch
@ -58,6 +62,7 @@ Documentation for %{name}
%setup -q -T -n %{gem_name}-%{version} -b 1
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec
%patch0 -p1
%patch100 -p1
%build
@ -106,6 +111,9 @@ rspec spec/ || rspec --tag ~broken
%doc %{gem_docdir}
%changelog
* Fri Dec 2 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-2
- Pull upstream patch (under review) for ruby filer deadlock treatment
* Thu Oct 27 2022 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.12.0-1
- 3.12.0