Deadlock with Sequel 5.52 and ActiveSupport Core Extensions under Ruby < 3.1 #1816
rgalanakis
started this conversation in
General
Replies: 1 comment
-
Thanks for the report. I suppose I can check whether |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was originally going to file this as a bug, but I couldn't in good conscience file a bug against Sequel involving Active Support core extensions, and I don't think it has a good solution other than 'do not install the activesupport class core extensions'. I figure it was a nice writeup and is good reference so didn't want to get rid of it and figured the mailing list is a good place. And if you can think of a solution to make Sequel subclasses and ActiveSupport core extensions work well together pre-Ruby 3.1, that'd be swell (though it actually wouldn't affect any of our current projects so nbd to me).
Complete Description of Issue
Sequel's Subclasses plugin was recently updated to make use of Ruby 3.1's
Object.subclasses
method in 185efe5It did this by removing the Sequel-land
subclasses
method, sodescendants
calls the built-insubclasses
method. It checks whether to use this based onObject.respond_to?(:subclasses)
.If ActiveSupport core extensions are installed, they will also install subclasses/descendants methods. This code has churned recently due to the Classes.descendants changes (I saw you were involved in the discussion), but I think it's still an issue at HEAD.
Under Ruby 3.1, this isn't a problem. ActiveSupport doesn't install either subclasses nor descendants; Sequel doesn't install subclasses; Sequel descendants uses Ruby's built-in subclasses.
Under earlier Ruby, Sequel 5.51 and earlier, and ActiveSupport, this also wasn't an issue- ActiveSupport installs its methods, then using the
subclasses
plugin would replace both of them with Sequel's implementation.However under earlier Ruby, Sequel 5.52, and ActiveSupport, what happens is:
Object.respond_to?(:subclasses)
. It does (because the core extensions). Sequel only overridesdescendants
.descendants
calls ActiveSupport'ssubclasses
. ActiveSupportsubclasses
callsdescendants
, which goes back into Sequel'sdescendants
, causing a deadlock inSequel.synchronize
(it would eventually stack overflow if not for that).Simplest Possible Self-Contained Example Showing the Bug
Full Backtrace of Exception (if any)
Beta Was this translation helpful? Give feedback.
All reactions