Rescue any EncodingError
while handling native support lib LoadError
#2514
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In 6.0.18 we started to try to encode the error string into ASCII before checking it for
dlopen
. This was done to try to handle invalid byte sequences caused by a bug in Ruby that's been fixed in Ruby 3.3.I've encountered a similar issue to the author and this fix hasn't fixed it. Instead, I now receive an
Encoding::UndefinedConversionError
which isn't handled. I've decided to wrap the whole error-handling logic with a rescue aroundEncodingError
but I'm open to usingStandardError
here - we're trying to handle an exception and be nice to Passenger users but ultimately we do not want the failure to load this extension to cause application errors and it currently does.Follow up to #2479
Fixes #2513