Comments (6)
@merlimat @kishorekasi
do you have time to check ? at the moment you are the most netty 4 experts in the group
from bookkeeper.
from bookkeeper.
from bookkeeper.
marked this as a blocker for 4.5.0, since it seems to indicate some kind of reference leaking in current code base.
from bookkeeper.
@merlimat and me were looking together at this issue. @merlimat found the problem on how do we handling the invalid op code in v2 protocol.
in TestBackwardCompat#testCompact400, the test is to verify the current client can't talk to a 4.0.0 server.
The 4.5.0 client is sending a protobuf encoded request to 4.0.0 server. The 4.0.0 server will interpret the 4.5.0 protobuf encoded request, but it will realize this is bad request and sending v2 protocol encoded response. because the request is a bad request, 4.0.0 server sent a response back with unknown op code.
In current v2 ResponseEnDecoder (listed as below), when it doesn't know the op code, it will return the buffer to the channel. this might cause the misbehavior in the channel pipeline to decrement reference count.
`
@OverRide
public Object decode(ByteBuf buffer)
throws Exception {
int rc;
long ledgerId, entryId;
int packetHeader = buffer.readInt();
byte version = PacketHeader.getVersion(packetHeader);
byte opCode = PacketHeader.getOpCode(packetHeader);
switch (opCode) {
case BookieProtocol.ADDENTRY:
rc = buffer.readInt();
ledgerId = buffer.readLong();
entryId = buffer.readLong();
return new BookieProtocol.AddResponse(version, rc, ledgerId, entryId);
case BookieProtocol.READENTRY:
rc = buffer.readInt();
ledgerId = buffer.readLong();
entryId = buffer.readLong();
if (rc == BookieProtocol.EOK) {
ByteBuf content = buffer.slice();
return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId, content.retain());
} else {
return new BookieProtocol.ReadResponse(version, rc, ledgerId, entryId);
}
case BookieProtocol.AUTH:
ByteBufInputStream bufStream = new ByteBufInputStream(buffer);
BookkeeperProtocol.AuthMessage.Builder builder
= BookkeeperProtocol.AuthMessage.newBuilder();
builder.mergeFrom(bufStream, extensionRegistry);
BookkeeperProtocol.AuthMessage am = builder.build();
return new BookieProtocol.AuthResponse(version, am);
default:
return buffer;
}
}
`
One suggested fix from @merlimat is to throw exception in the EnDeCoder when receiving unknown op code. so the netty can close the connection, error out the pending requests and cleaning up the resources.
from bookkeeper.
@kishorekasi my error report was against an old version of the master.
I think that @merlimat suggestion is good. Can you give it a try?
from bookkeeper.
Related Issues (20)
- [improve] Support specifying multiple journalDir as bookie start command parameters
- [improve] update doc & fix listfilesondisc cmd description
- [improve][docker] fix yaml and dockerfile HOT 1
- BK build fails with jdk 21 (LTS) HOT 6
- LedgerHandle don't track failure on PendingReadOp
- Flaky-test: DeferredSyncTest.testForceWillAdvanceLacOnlyUpToLastAcknoledgedWrite HOT 4
- Replace the usage of PowerMock with Mockito in the Bookkeeper tests HOT 1
- Binaries are invalid when compiled on Java 11 and run on Java 8 HOT 3
- Dirty data risk in ledger recovery. HOT 3
- Bookie could coredump when it is shutting down
- Confused output while use comand line option --help to show bookie usage
- HTTP 504 Gateway timeout HOT 1
- BP-65: implement load balance for select bookie HOT 2
- ZKRegistrationClient watch error. HOT 3
- Useless BookieCheckTask. HOT 2
- BP-66: support throttling for zookeeper read during rereplication.
- When a client adds entries synchronously to an opened ledger and a bookie crashes, the client may get stuck. HOT 5
- Bookie translate to readonly mode due to NullPointerException while flushing mem table.
- No such ledger exists on Bookies but ledgermetadata exist HOT 9
- Replacement for `bookie_journal_JOURNAL_CB_QUEUE_SIZE`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bookkeeper.