GH-939: Remove reflection for gRPC buffers#954
Conversation
This reverts commit e109e2c.
This comment has been minimized.
This comment has been minimized.
| if (detachedByteBuffer == null || !detachedByteBuffer.isDirect()) { | ||
| closeQuietly(detachedStream); | ||
| return null; | ||
| } |
There was a problem hiding this comment.
Since we detached the stream, if we give up here, aren't we erroneously going to discard the actual data? My understanding of Detachable is that the original stream is now invalid, right?
There was a problem hiding this comment.
good catch. Actually this is redundant, the isDirect is already checked at the beginning of the method so I just removed it
lidavidm
left a comment
There was a problem hiding this comment.
All builds fail:
Error: Non-test scoped test only dependencies found:
Error: io.grpc:grpc-core:jar:1.78.0:compile
|
CC @ejona86 in case you do want to look over this |
|
@xborder it seems this doesn't actually work... |
|
@lidavidm Seems like a chicken and the egg problem. grpc-core can't be a compile dependency because it is detected as unused by CI although it is still required in runtime ( I've changed the tests to use a mock for the dependency it had on grpc-core. This seemed to have solved the issues from the two previous runs but probably diminishes the relevance of these tests |
|
@xborder thanks for the update. Let me take a look. |
|
@lidavidm I think there's something I overlooked. |
| new ForeignAllocation(size, dataAddress) { | ||
| @Override | ||
| protected void release0() { | ||
| closeQuietly(detachedStream); |
There was a problem hiding this comment.
Don't we risk a race condition here where we close the stream (detached) before a write ?
There was a problem hiding this comment.
I don't think so. The buffer can't be written after detaching
There was a problem hiding this comment.
That's my point: the buffer can't be written, but nothing prevent to use the detached buffer to be written after the release. Let me recheck here.
What's Changed
Closes #939.