We are using Flatbuffer with Java bindings. The application is running Netty4 and has following code for handling Netty request:
String id;
try {
request = PostRequest.getRootAsPostRequest(msg.getPayloadBuffer().nioBuffer());
id = request.id(); // string
} catch (final Exception exception) {
ctx.writeResponseAndFlush(StatusCode.StatusCode400, exception);
return;
} finally {
msg.getPayloadBuffer().release();
}
traceId = request.traceId(); // <-- this string sometimes becomes null
This code occasionally sets traceId
as null and I am not able to fully understand why.
Is it because the underlying buffer might have been release and reused as I am releasing it in finally
block?
Even then, why does it happen only rarely and not always?