Vladimir Ozerov created IGNITE-1215:
---------------------------------------
Summary: GridConnectionBytesVerifyFilter doesn't write magic header.
Key: IGNITE-1215
URL:
https://issues.apache.org/jira/browse/IGNITE-1215 Project: Ignite
Issue Type: Bug
Components: general
Affects Versions: 1.1.4
Reporter: Vladimir Ozerov
Priority: Critical
GridConnectionBytesVerifyFilter performs magic header check on read, but do not add magic header on write.
Test:
1) Open GridNioSelfTest class.
2) Add filter {code}new GridConnectionBytesVerifyFilter(log){code} in the serverBuilder() method.
3) Run testAsyncSendReceive() test and verify it fails.
4) Open GridConnectionBytesVerifyFilter class.
5) Add a field:
{code}
private static final int MAGIC_WRITE_KEY = GridNioSessionMetaKey.nextUniqueKey();
{code}
6) Change onSessionWriteMethod as follows:
{code}
/** {@inheritDoc} */
@Override public GridNioFuture<?> onSessionWrite(GridNioSession ses, Object msg) throws IgniteCheckedException {
if (!ses.accepted() && ses.meta(MAGIC_WRITE_KEY) == null) {
proceedSessionWrite(ses, ByteBuffer.wrap(U.IGNITE_HEADER)).get();
ses.addMeta(MAGIC_WRITE_KEY, true);
}
return proceedSessionWrite(ses, msg);
}
{code}
7) Re-run the test and verify that now it pass.
Proposed implementation plan:
1) Apply the fix approximately as described above, but with magic header being attached to the passed buffer (not being sent as a separate message).
2) Review all usages of GridConnectionBytesVerifyFilter and remove manual magic header send there. As I see it is only used in TcpCommunicationSpi.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)