Hi,

We made some investigations into passing collection of objects from a 
flex client to red5-6.0 server. Here goes the results.

*Case 1:*
------------------------------------------------------------------------

Server code:
---------------
public void tryTVOWithLargeObejcts(TransferValueObject tvo){
        System.out.println(tvo);
    }

TransferValueObject class in Java
-------------------------------------------------------------------------------------------------------------------------
public void readExternal(IDataInput input)
    {
        ObjectMap map = (ObjectMap) input.readObject();
        ObjectMap newmap = (ObjectMap) input.readObject();
        log.debug(map+"::"+newmap);

       //If you try the same thing with the following lines then also it 
fails.

        Object map =  input.readObject();
        Object newmap = input.readObject();
        log.debug(map+"::"+newmap);

    }

TransferValueObject(which is a remote object bound to 
TransferValueObject in Java) [FLEX CLIENT code]
-----------------------------------------------------------------------------------------------------------------------------------------------------------
 public function writeExternal(output:IDataOutput):void {
            var ob:Object = new Object();
            ob['first'] = 3243243;
            ob['second'] = 3243243;

            var innerObj:Object = new Object();
            innerObj['first'] = 32432443;
            innerObj['second'] = 324333243;

            //This will fail in the server
            output.writeObject(ob);
            output.writeObject(innerObj);

             //If you replace the above two lines with these, then also 
the server will fail to read
            ob['inner'] = innerObj;
            output.writeObject(ob);
            
  }

*Result :* java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
*Root cause :* org.red5.server.net.protocol.ProtocolException: Error 
during decoding

If you continue doing this for 3-4 times, the decoding layer breaks in 
the server as follows.

[ERROR] 141772 SocketAcceptorIoProcessor-0.0:( 
org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.error ) Error in 
packet at 0
java.lang.NullPointerException
        at 
org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.decodeHeader(RTMPProtocolDecoder.java:416)

*and the client is disconnected*


*Case 2: Editing the echotest.mxml to get the exception in the server.*
------------------------------------------------------------------------
Try the following the echotest.mxml file. See the server breaking as above.

            // Add AMF3 specific tests below
            var ext: ExternalizableClass = new ExternalizableClass();
            var ext1: ExternalizableClass = new ExternalizableClass();
            testParams.push(ext);
            var tmp_1: Array = new Array();
            tmp_1.push(ext);
            //tmp_1.push(ext);
            tmp_1.push(ext1);
            testParams.push(tmp_1);

*Result :* java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
*Root cause : *[ERROR] 309608 SocketAcceptorIoProcessor-0.1:( 
org.red5.server.net.rtmp.codec.RTMPProtocolDecoder.error ) Error in 
packet at 0
java.lang.IllegalArgumentException
        at java.nio.Buffer.limit(Unknown Source)

*Case 3: Some more possibilities to get into same errors
*
------------------------------------------------------------------------
I was trying with some more possibilities and here goes the results.

*Case 3.1. *
--------
    - The client passes a HashMap (which extends Dictionary extends 
Object) which contains custom objects
   - The server receives a Object[]
    Result :  doesnt work
    Exception :  Buffer underflow

*Case 3.2. *
--------
   - The client passes Array of custom objects
   - The server receives ArrayList
  Result:Doesn't work
  Exception: IndexOutOfBounds

  - The client has an HashMap and one of those parameters is a custom 
object. It works!!. But not more than one custom object inside the HashMap.


This sounds like a restriction on passing custom objects. Great if any 
of the code committers could address this ASAP.

Thanks a lot.

-Sri.






_______________________________________________
Red5 mailing list
[email protected]
http://osflash.org/mailman/listinfo/red5_osflash.org

Reply via email to