aesteve / nubes

Annotation layer on top of Vert.x 3
Apache License 2.0
121 stars 35 forks source link

Is Boon a safe option, we have had VM crashes caused by Boon #47

Closed apatrida closed 8 years ago

apatrida commented 9 years ago

Is Boon a safe option? Here is my opinion: no.

For speed optimizations the code makes assumptions about internal class layouts, arrays, etc and doing simple things as a custom deserializer caused Java VM crashes. And that library brings in all sorts of errant utilities.

It has code in JsonFastParser that says it might cause memory leaks, so at least avoid that parser.

Also look in the code for things like:

@SuppressWarnings ( { "unchecked", "SuspiciousSystemArraycopy" } )

We found odd things creating a custom Joda datetime serializer that did very little, but plug it in, serialize, VM crash.

Search the code for where and how sun.unsafe is used to directly access the body of strings. Now take a JVM language which wraps string, hand it to those and see if you get a loud Boom. And how does that affect Open JDK usage?

https://github.com/boonproject/boon/blob/1b741669e7fc1a64afdc342cdb4bb7359c995b94/boon/src/main/java/org/boon/core/reflection/FastStringUtils.java

If the string is wrapped by something (which some languages do), the value offsets become -1 which cause pointer math to go off into unknown space. The code doesn't handle that at all and no-ops on field not found in the wrapper.

Boon gets extra speed from unsafe things. We got sick of the crashes, and never went back to try again.

aesteve commented 9 years ago

Thanks for your insight. Looks like you had trouble in the past with Boon. I haven't faced any issue myself so far (even with other projects).

So you're furtively suggesting to use Jackson, am I right ? Would it be as convenient as Boon for end-users (annotations are available iirc, long time since I didn't work with Jackson, custom adapters ?).

What about performances ?

apatrida commented 9 years ago

I use Jackson, and performance is fine. It is one of the most used JSON frameworks. They have a Jackson-jr with less features that might also work. But for easy binding there are methods on ObjectMapper that can go from any input to any output data type. Useful.

aesteve commented 8 years ago

I'll have a look for 2.0.

If it doesn't introduce any breaking change I'll change boon for Jackson for 1.1.

aesteve commented 8 years ago

Done in 34750d74ab5d4ce2249fb6c77966df262d5d77a2