Skip to content
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

Rescue any EncodingError while handling native support lib LoadError #2514

Closed

Conversation

dannyfallon
Copy link

@dannyfallon dannyfallon commented Dec 6, 2023

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 around EncodingError but I'm open to using StandardError 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

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 around `EncodingError` but I'm open to using `StandardError`
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.
@CamJN
Copy link
Contributor

CamJN commented Dec 27, 2023

Very strange that ruby throws an UndefinedConversionError when invalid: :replace is used. Anyway please sign the contributor agreement.

@CamJN
Copy link
Contributor

CamJN commented Feb 13, 2024

Just a reminder I cannot merge this without a signed contributor agreement.

@CamJN CamJN closed this Mar 26, 2024
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

Successfully merging this pull request may close these issues.

String conversion while handling native Ruby support lib LoadErrors can cause errors
2 participants