Ticket #467 (closed task: fixed)

Opened 13 months ago

Last modified 13 months ago

Check ByteArray use cases

Reported by: nick Owned by: nick
Priority: major Milestone: 0.4.1
Component: Testing Version: 0.4
Keywords: Cc: cornelius.keller@…
Fixed in revision: Branch: branches/use-amf3-objects-467
Author:

Description

It has been reported in IRC that returning a blank ByteArray - return ByteArray() causes Flash to respond with an EOFError.

This needs to be investigated to see if this is the case and if so, why this is occurring.

Attachments

main.mxml Download (1.2 KB) - added by thijs 13 months ago.
main.swf Download (245.7 KB) - added by thijs 13 months ago.
server.py Download (0.7 KB) - added by thijs 13 months ago.
bytearray-demonstration.tar.gz Download (47.3 KB) - added by jck 13 months ago.
asunit TestCase and pyamf Server using django gatway demonstrating the problem
server.2.py Download (2.1 KB) - added by jck 13 months ago.
wsgi server with the same functonalyty as the django gateway
crossdomain.xml Download (202 bytes) - added by jck 13 months ago.
ByteArrayTest.as Download (1.6 KB) - added by jck 13 months ago.
new version of Asunit test with mor trace output
trace in english.txt Download (1.0 KB) - added by jck 13 months ago.
trace outut of a test run with english error messages
sabyetarraytype.py Download (355 bytes) - added by jck 13 months ago.
Custom SQLAlchemy Type to illustrate where bytearrays created on the server could be useful
wireshark_bytearray_conversations.txt Download (1.1 KB) - added by jck 13 months ago.
conversation captured from the wire with wireshark of testEcho (wokrs) and testGet (works not)
working.raw Download (418 bytes) - added by jck 13 months ago.
Raw wireshark capture of the testEcho conversation
defect.raw Download (417 bytes) - added by jck 13 months ago.
Wireshark capture of the not working getExample conversation.

Change History

  Changed 13 months ago by nick

  • owner changed from nick to thijs
  • status changed from new to assigned

  Changed 13 months ago by thijs

  • status changed from assigned to accepted

Changed 13 months ago by thijs

Changed 13 months ago by thijs

Changed 13 months ago by thijs

follow-up: ↓ 4   Changed 13 months ago by thijs

  • status changed from accepted to closed
  • resolution set to worksforme

Couldn't reproduce the issue with attached test programs, closing the ticket, reopen with a better use case.

Changed 13 months ago by jck

asunit TestCase and pyamf Server using django gatway demonstrating the problem

in reply to: ↑ 3   Changed 13 months ago by jck

Replying to thijs:

Couldn't reproduce the issue with attached test programs, closing the ticket, reopen with a better use case.

Hi thijs,

I am Cornelius, the reporter of the problem in the irc channel. I attatched an asunit testcase and demo server to illustrate the problem. I hope that helps you to understand what didnt work for me.

trace outupt of my test is:

[SWF] home/jck/workspace/bytearray-client/BATestRunner.swf - 27.548 bytes after decompression Warnung: In Domäne localhost wird keine Metarichtlinie angegeben. Standard-Metarichtlinie 'master-only' wird angewendet. Diese Konfiguration ist veraltet. Hinweise zur Behebung dieses Problems finden Sie unter  http://www.adobe.com/go/strict_policy_files_de ReferenceError: Error #1056: Eigenschaft data in test.Example kann nicht erstellt werden. ReferenceError: Error #1056: Eigenschaft id in test.Example kann nicht erstellt werden. echoResult 1

ReferenceError: Error #1056: Eigenschaft data in test.Example kann nicht erstellt werden. Error: Error #2030: Das Dateiende wurde erkannt.

[Fault] exception, information=TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine Methode eines null-Objektverweises ist nicht mglich. Fault, ByteArrayTest.as:57

57 trace(myResult.id);

hth Cornelius

  Changed 13 months ago by jck

  • cc cornelius.keller@… added
  • status changed from closed to reopened
  • resolution worksforme deleted

  Changed 13 months ago by thijs

  • owner changed from thijs to jck
  • status changed from reopened to assigned

Hi jck, thanks for the test case but before I can try this out I need:

  • a simple standalone WSGI server, not a complete project. Unless you can't reproduce the bug with the WSGIGateway, and only with the DjangoGateway
  • a simple Flex project with one mxml file, not a complete project including dependencies like asunit, it makes it much harder to narrow down the issue
  • English error messages, my first language is Dutch, and even though it looks a lot like German, it doesn't mean we understand what is the problem here when looking at your error messages

Assigning it back to you.

  Changed 13 months ago by jck

Hi thijs,

I may rewrite the Server to use wsgi an see if the problem is still there. I am not shure if I can provide mxml, cause I dont have flexbuilder.

The errormessages are not genearated by my code, but by the flash player. They are german due to my System settings and will appear in english or dutch in your environmnet.

  Changed 13 months ago by thijs

Jck, a single Actionscript class is fine as well, as long as I'm able to compile it. I tried with FlexBuilder but it's throwing some errors and I gave up after 10 minutes, its a busy day. Cheers, Thijs

Changed 13 months ago by jck

wsgi server with the same functonalyty as the django gateway

Changed 13 months ago by jck

Changed 13 months ago by jck

new version of Asunit test with mor trace output

Changed 13 months ago by jck

trace outut of a test run with english error messages

Changed 13 months ago by jck

Custom SQLAlchemy Type to illustrate where bytearrays created on the server could be useful

  Changed 13 months ago by jck

  • owner changed from jck to thijs

Hi thijs,

I created the wisgi Server, and I attatched the Asunint TestCase as a seperate actionscript file. The two methods testEcho and testGet in there shuld work in any other context, even in an mxml file. Sorry that my actionscript knowledge is too poor to make it runnable standalone. I am more into serverside programming and happy if i can use ASunit to test my gateways.

- Cornelius

follow-up: ↓ 11   Changed 13 months ago by thijs

  • owner changed from thijs to jck

When I run your SWF it throws this error:

ReferenceError: Error #1065: Variable ByteArrayTest is not defined.

Looking at your Example class it seems it's missing the RemoteClass definition, like:

[RemoteClass(alias="Example")]

When I then run the example with that definition it's not throwing any errors for me. So make your Example class look like this and it should be fine:

package {
	import flash.utils.ByteArray;	/** * @author jck */

	[RemoteClass(alias="Example")]
			
	public class Example {
		var id : int = 1;
		var data : ByteArray = new ByteArray();
		
	}
}

If you want to have Example in a package, like test.Example, then make sure this is also defined in the Python server, like:

class Example(object):
  def  __init__(self):
      self.id = 1
      self.data = ByteArray()

register_class(Example, 'test.Example')

Let me know if that fixes the problem and then close the ticket.

Changed 13 months ago by jck

conversation captured from the wire with wireshark of testEcho (wokrs) and testGet (works not)

in reply to: ↑ 10   Changed 13 months ago by jck

  • owner changed from jck to thijs

Hi thijs,

why shold testEcho work ant testGet fail if it is only a probem with the alias?

If I register the alias with the annotation as you suggested, both tescases fail and I dont see an alias captured in the stream by wireshark.

I attatched the conversation of the two tests captured with wireshark. As you can see there the empty bytearray created on the server is encoded differently than the one created on the client and echoed back.

  Changed 13 months ago by thijs

  • owner changed from thijs to nick

I'll let Nick check out the wireshark dump when he has time.

Changed 13 months ago by jck

Raw wireshark capture of the testEcho conversation

Changed 13 months ago by jck

Wireshark capture of the not working getExample conversation.

  Changed 13 months ago by nick

  • status changed from assigned to accepted

  Changed 13 months ago by nick

This turns out to be the way amf0.Encoder is handling use_amf3. This property should only be used for object types.

Branching to source:pyamf/branches/use-amf3-objects-467

  Changed 13 months ago by nick

  • keywords review added
  • owner nick deleted
  • status changed from accepted to assigned

  Changed 13 months ago by thijs

  • keywords review removed
  • owner set to nick

EchoTest and ParseDump look good. When I run trial pyamf it prints this error though, which isn't related to this ticket but could be solved nevertheless I guess:

pyamf.tests.gateway.test_twisted
  AMF0RequestProcessorTestCase
    test_auth_fail ...                                                     [OK]
    test_deferred_auth ...                                                 [OK]
    test_deferred_preprocessor ... No handlers could be found for logger "pyamf.remoting.gateway.twisted.TwistedGateway.0x1b43e50"

  Changed 13 months ago by thijs

  • branch set to branches/use-amf3-objects-467

  Changed 13 months ago by nick

  • status changed from assigned to closed
  • resolution set to fixed

Merged in r2213.

Note: See TracTickets for help on using tickets.