Update native_support.rb to allow load_native_extension handle invalid byte sequences #2479
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.
We have been getting the following errors from passenger-6.0.17 via RPM from the Passenger REPO on CentOS7 :
The /usr/lib64/ruby/vendor_ruby/passenger_native_support.so in the RPM is correctly linked to ruby-2.0, but we are using a custom ruby-3.2.1 so the cause of the exception is correct.
Eventually the exception doesn't have any invalid byte sequences in it and passenger starts the application normally and carries on normally until the next web server (Apache) restart. This is random though.
This is caused by the LoadError exception having invalid byte sequences in its message, I have patched the rescue to replace the invalid byte sequences on versions of ruby that support 'String.encode'. I have tested this on all versions of ruby from 1.8.7 to 3.2.1.
This is the exception on ruby-3.1.3
This is the exception on ruby-3.2.1
So, it looks like only ruby-3.2.x could possibly generate an invalid byte sequence.