You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "ncanis2 (JIRA)" <ji...@apache.org> on 2009/06/02 10:11:08 UTC

[jira] Issue Comment Edited: (DIRMINA-714) Packet sequence is unordered in multi thread.

    [ https://issues.apache.org/jira/browse/DIRMINA-714?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12715410#action_12715410 ] 

ncanis2 edited comment on DIRMINA-714 at 6/2/09 1:11 AM:
---------------------------------------------------------

Thank you for your reply. But I have still something bug.

===========================================================================

After I read this, received newest source from svn(mina).

But, I had problem in heavy load server.

This is server log
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=140, protocol=14
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=141, protocol=13
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=142, protocol=14
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=144, protocol=19

This is client log
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=13, seq=141
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=14, seq=142
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=19, seq=144
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=14, seq=143


in Server.
If I send 141,142,143,144,    I receive 141,142,144,143  in messageSent method.
So client can't receive right packet from server.

=============================================
This is my encoder source..
- MessageEncoder
	@Override
	public void encode(IoSession session, Object message, ProtocolEncoderOutput out)
			throws Exception {
		RomiMessage msg = (RomiMessage) message;
		IoBuffer buf_in = msg.getBuf();
		IoBuffer buf_out = IoBuffer.allocate(buf_in.limit()+4).sweep();

		buf_out.setAutoExpand(true); // Enable auto-expand for easier encoding		
		encodeBody(session,msg, buf_out);		
		buf_out.flip();
		out.write(buf_out);
		msg = null;
	}
=============================================
This is my decoder source..
- MessageDecoder
@Override
	public MessageDecoderResult decodable(IoSession session, IoBuffer in) {
		
		if (in.prefixedDataAvailable(HEADER_SIZE, MAX_LENGTH)) {
			return MessageDecoderResult.OK;
		} else {
			return MessageDecoderResult.NEED_DATA;
		}
		// Return NOT_OK if not matches.
		// return MessageDecoderResult.NOT_OK;
	}

	@Override
	public MessageDecoderResult decode(IoSession session, IoBuffer in,
			ProtocolDecoderOutput out) throws Exception {

		MessageDecoderResult result = decodable(session,in);
		if(result!=MessageDecoderResult.OK) return result;
		
		IoBuffer buf = decodeBody(session, in);
		if (buf == null) {
			return MessageDecoderResult.NOT_OK;
		} else {
			out.write(buf);
		}

		return MessageDecoderResult.OK;
	}



      was (Author: ncanis2):
    Thank you for your reply. But I have still something bug.

===========================================================================

After I read this, received newest source from svn(mina).

But, I had problem in heavy load server.

This is server log
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=140, protocol=14
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=141, protocol=13
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=142, protocol=14
[16:51]-S[DemuxRomiDecoder(decodeBody:162)]:Trace Log =MSG Recv seq=144, protocol=19

This is client log
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=13, seq=141
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=14, seq=142
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=19, seq=144
[2009-06-02 16:51] ERROR [GameEventFilter(close:108)] :Trace Log =Really MSG Sent=> protocol=14, seq=143


in Server.
If I send 141,142,143,144,    I receive 141,142,144,143  in messageSent method.
So client can't receive right packet from server.

=============================================
- MessageEncoder
	@Override
	public void encode(IoSession session, Object message, ProtocolEncoderOutput out)
			throws Exception {
		RomiMessage msg = (RomiMessage) message;
		IoBuffer buf_in = msg.getBuf();
		IoBuffer buf_out = IoBuffer.allocate(buf_in.limit()+4).sweep();

		buf_out.setAutoExpand(true); // Enable auto-expand for easier encoding		
		encodeBody(session,msg, buf_out);		
		buf_out.flip();
		out.write(buf_out);
		msg = null;
	}
=============================================
- MessageDecoder
@Override
	public MessageDecoderResult decodable(IoSession session, IoBuffer in) {
		
		if (in.prefixedDataAvailable(HEADER_SIZE, MAX_LENGTH)) {
			return MessageDecoderResult.OK;
		} else {
			return MessageDecoderResult.NEED_DATA;
		}
		// Return NOT_OK if not matches.
		// return MessageDecoderResult.NOT_OK;
	}

	@Override
	public MessageDecoderResult decode(IoSession session, IoBuffer in,
			ProtocolDecoderOutput out) throws Exception {

		MessageDecoderResult result = decodable(session,in);
		if(result!=MessageDecoderResult.OK) return result;
		
		IoBuffer buf = decodeBody(session, in);
		if (buf == null) {
			return MessageDecoderResult.NOT_OK;
		} else {
			out.write(buf);
		}

		return MessageDecoderResult.OK;
	}


  
> Packet sequence is unordered in multi thread.
> ---------------------------------------------
>
>                 Key: DIRMINA-714
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-714
>             Project: MINA
>          Issue Type: Bug
>          Components: Filter
>    Affects Versions: 2.0.0-M5
>         Environment: xp
>            Reporter: ncanis2
>             Fix For: 2.0.0-M6
>
>
> Hi.
> Packet sequence is unordered.
> = Server & Client = 
> chain.addLast("codec", new ProtocolCodecFilter(rcf));
> chain.addLast("executor", getExecuteFilter());    => OrderedThreadPoolExecutor c = new OrderedThreadPoolExecutor(20,100);
> If server send 1,2,3,4,5,6 , client receive 1,2,3,4,6  from server.
> Clients : 100.
> where I am wrong? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.