gelf-rb icon indicating copy to clipboard operation
gelf-rb copied to clipboard

Remove opportunistic loading of `yajl/json_gem`

Open jnraine opened this issue 5 years ago • 6 comments

Requiring yajl/json_gem causes JSON.parse, JSON.generate, #to_json, and other built-in methods to be overridden with the faster YAJL implementation. Faster is, as a rule, better so this seems like a positive change overall. However, because this change extends outside of gelf-rb and impacts any place JSON is parsed or generated using the standard library interface, it can have surprising and unexpected consequences.

When I updated gelf-rb to version 3.1.0, parts of my app started to behave differently. Specifically, U+2028 and U+2029 characters stopped being escaped within JSON strings. For a Rails app, which already overrides the standard library interface, this can be a problem [1]. (This will only impact folks who use YAJL without require 'yajl/json_gem'.)

To remedy this, yajl/json_gem is no longer required by default. This makes the optimization of JSON parsing the responsibility of the app/script/person requiring gelf-rb.

[1] http://timelessrepo.com/json-isnt-a-javascript-subset

jnraine avatar Dec 24 '18 20:12 jnraine

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Dec 24 '18 20:12 CLAassistant

@AlekSi does this seem like a change useful to the project? Right now, we maintain an empty file to make sure yajl/json_gem isn't loaded when graylog-rb is required. 😅

jnraine avatar May 21 '19 18:05 jnraine

I have no idea, I stopped maintaining this gem (and using it, and using Ruby) years ago.

AlekSi avatar May 21 '19 19:05 AlekSi

Well, perhaps it would be a good idea to merge the change? Does anyone else have the ability to merge this in? @AlekSi ? That would be nice. "I don't know, I don't maintain this" is very unhelpful and results in a bunch of useless forks getting created for a project. The impact of this change is pretty significant and I think merging this would make 3.1.x usable for a wider audience.

farvour avatar Mar 04 '20 20:03 farvour

I don't have access to merge this change. I'm not a maintainer for a long time already. Sorry.

/cc @lennartkoopmann

AlekSi avatar Mar 05 '20 17:03 AlekSi

Alexey,

Thanks. I did open up a separate issue asking who can maintain. 👌👍🏻

T

On Mar 5, 2020, at 09:15, Alexey Palazhchenko [email protected] wrote:

 I don't have access to merge this change. I'm not a maintainer for a long time already. Sorry.

/cc @lennartkoopmann

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

farvour avatar Mar 05 '20 17:03 farvour