Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Unknown error when parsing a specific string in 2.0.6 #70

xaviervia opened this Issue Feb 18, 2013 · 6 comments


None yet
2 participants

Hi! I got my ruby completely frozen on:

require 'oj'

Oj.load "{\"id\": 303628670768128001,\"additionalType\":\"http://getfetcher.net/Item\",\"description\":\"@DoMeuBieber :)) mas kra pode parando d fazer isso ainda mais por causa d mlk eu sei que no  sua culpa mas vc pode evitar!\",\"author\": {\"additionalType\":\"http://getfetcher.net/Item\",\"id\":1054045717,\"name\":\"i'm natriznator\",\"dateRegistered\":{\"^t\":1357095124.000000000},\"description\":\"menos falsidade e mais liberdade\",\"url\":\"https://twitter.com/hotlov4to\"},\"viewer\": {\"additionalType\":\"http://getfetcher.net/Item\",\"id\":861875166,\"name\":\"Fetcher Dev\",\"dateRegistered\":{\"^t\":1349377226.000000000},\"description\":null,\"url\":\"https://twitter.com/FetcherDev\"},\"dateCreated\": {\"^t\":1361225690.000000000},\"provider\": [\"twitter\",\"web\"],\"url\": \"https://twitter.com/hotlov4to/status/303628670768128001\",\"_id\": {\"^o\":\"BSON::ObjectId\",\"data\":[81,34,167,251,70,246,92,80,135,0,0,1]}}"

The native JSON parser of Ruby does a fine work.

It gives no error, just freezes. It used to work on 2.0.3 :)


ohler55 commented Feb 18, 2013

I will look into it immediately.

Thanks :)


ohler55 commented Feb 18, 2013

To fix your problem set the auto_define option to true. That should take care of the immediate problem. I will find out why the exception is not being raised and is hanging instead. This was a change to make Oj more "safe" along with the other JSON parsers. Apparently my testing was not complete enough.


ohler55 commented Feb 18, 2013

Fixed the problem. The BSON class had not been loaded so Oj tried to add variables to nil. That apparently freezes Ruby. Release 2.0.7 has the fix. Thank for finding the bug.


ohler55 commented Mar 1, 2013

Since there was no reply the assumption is the fix worked.

@ohler55 ohler55 closed this Mar 1, 2013

Sorry for the delay, I got no chance to check it in production before. I checked it now properly.

2.0.7 is working perfectly fine. Thanks very much :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment