Skip to content

Spring will attempt to sanitize a backtrace even if it's frozen (Spring/dry-monads incompatibility) #609

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
johnmaxwell opened this issue Dec 9, 2019 · 2 comments

Comments

@johnmaxwell
Copy link

johnmaxwell commented Dec 9, 2019

Thank you for your work on Spring. It's saved me a lot of seconds over the years :)

I encountered an incompatibility with rails/spring when I was installing a working with a new gem dry-monads

Repro repo: https://github.com/johnmaxwell/spring_dry_monads_break
dry-monads ticket: dry-rb/dry-monads#115

The issue is that dry-monads raises an Error with a frozen, empty array for the backtrace, and Spring's patched raise attempts to sanitize the backtrace without checking if it is frozen. This causes an error: can't modify frozen Array (FrozenError)

https://github.com/dry-rb/dry-monads/blob/11ca509889044ea75eb7d21e2a8f1691295de92e/lib/dry/monads/do.rb#L134

$!.backtrace.reject! { |line| line.start_with?(lib) }

Does it make sense to check that the backtrace isn't frozen before attempting sanitization?

Spring 2.1.0
Rails 6.0.1
Ruby 2.6.5
dry-monads: 1.3.2

@timriley
Copy link

Hi @rafaelfranca, I'm interested in your reasoning behind closing this issue, if you don't mind sharing? Is this more of a "WONTFIX" situation, or are you considering a frozen? check before attempting to mutate backtrace arrays? FWIW, dry-monads has changed its behaviour here to accomodate spring, but this might still potentially be a source of user confusion in the future. Thanks!

@rafaelfranca
Copy link
Member

I closed because the only ofender AFAIK was dry-monads and the behavior changed there. But I can change to check for frozeness for sure.

rafaelfranca added a commit that referenced this issue Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants