Skip to content

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

Closed
@johnmaxwell

Description

@johnmaxwell

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions