HADOOP-11494. Lock acquisition on WrappedInputStream#unwrappedRpcBuffer may race with another thread. Contributed by Ted Yu.
This commit is contained in:
parent
ffc75d6ebe
commit
3472e3bd6c
@ -573,8 +573,7 @@ public int read(byte b[]) throws IOException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int read(byte[] buf, int off, int len) throws IOException {
|
||||
synchronized(unwrappedRpcBuffer) {
|
||||
public synchronized int read(byte[] buf, int off, int len) throws IOException {
|
||||
// fill the buffer with the next RPC message
|
||||
if (unwrappedRpcBuffer.remaining() == 0) {
|
||||
readNextRpcPacket();
|
||||
@ -584,7 +583,6 @@ public int read(byte[] buf, int off, int len) throws IOException {
|
||||
unwrappedRpcBuffer.get(buf, off, readLen);
|
||||
return readLen;
|
||||
}
|
||||
}
|
||||
|
||||
// all messages must be RPC SASL wrapped, else an exception is thrown
|
||||
private void readNextRpcPacket() throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user