End of file

0 views
Skip to first unread message

Don-Duong Quach

unread,
Nov 10, 2008, 4:26:55 PM11/10/08
to as3-amqp-user
Hi,

I just started using the library and created a demo to dive into
amqp. It works great through the latest flash player, but I'm
encountering an occasional error when running it in firefox. Is
anyone getting an "End of file encountered" error?

The error trace looks like this:

Error: Error #2030: End of file was encountered.
at flash.net::Socket/readBytes()
at org.amqp::Frame/readFrom()[./amqp_as3/src/org/amqp/Frame.as:55]
at org.amqp::Connection/parseFrame()[.//amqp_as3/src/org/amqp/
Connection.as:166]
at org.amqp::Connection/onSocketData()[./amqp_as3/src/org/amqp/
Connection.as:146]

Thanks,

Don Q.

Ben Hood

unread,
Nov 10, 2008, 7:56:28 PM11/10/08
to as3-am...@googlegroups.com
Hi Don,

On Mon, Nov 10, 2008 at 9:26 PM, Don-Duong Quach <geekr...@gmail.com> wrote:
> I just started using the library and created a demo to dive into
> amqp. It works great through the latest flash player, but I'm
> encountering an occasional error when running it in firefox. Is
> anyone getting an "End of file encountered" error?

What version of the library are you using? On what platform? Can you
give me some more information about your setup?

Ben

Don-Duong Quach

unread,
Nov 10, 2008, 10:52:20 PM11/10/08
to as3-amqp-user
Hi Ben,

I cloned the git repo on github with this commit:
80f98be2b0958a82474eeba48af55f19f71ef136
Using RabbitMQ 1.4.0 with Erlang R12B-4 on Ubuntu 8.04 in a VirtualBox
VM. Mac OSX 10.5 Flash player 10. Firefox 3.

You can check out my code here: git://github.com/geekrelief/flash-amqpong.git

Basically, I modified the PublishSubscribeTest code to send the
position of my mouse coordinates to the server. It also reads a
complementary queue for the mouse coordinates of a second client. So
there are two clients each representing a dot, Main is red and Main2
is blue. To run the demo, just build both swfs from the command line
with the "build" and "build2" scripts. The scripts expect mxmlc to be
in your PATH.

I haven't been able to consisently produce the error on my machine
(usually after a playing around with it a bit), but a friend of mine
gets it all the time. It seems like there's a mismatch between the
bytes reported available and bytes actually available in the frame. I
haven't looked into it more than that. Still need to get a better
understanding of AMQP.

Let me know if you need more info.

Thanks!

-Don Q.

On Nov 10, 4:56 pm, "Ben Hood" <0x6e6...@gmail.com> wrote:
> Hi Don,
>

Don-Duong Quach

unread,
Nov 10, 2008, 10:56:58 PM11/10/08
to as3-amqp-user
I forgot one more thing. If you d/l the my source, the build scripts
expect the demo directory to be inside the amqp-as3 src directory.

-Don Q.

Don-Duong Quach

unread,
Nov 10, 2008, 11:21:36 PM11/10/08
to as3-amqp-user
Hi Ben,

I just updated my source so that the mouse coordinates are written and
read as Floats. Before I was using Ints. Since the change I haven't
seen any errors. I'll do more testing and report back if I run into
issues.

-Don Q.

Ben Hood

unread,
Nov 11, 2008, 7:16:19 AM11/11/08
to as3-am...@googlegroups.com
Don Q,

On Tue, Nov 11, 2008 at 4:21 AM, Don-Duong Quach <geekr...@gmail.com> wrote:
> I just updated my source so that the mouse coordinates are written and
> read as Floats. Before I was using Ints. Since the change I haven't
> seen any errors. I'll do more testing and report back if I run into
> issues.

Ok, cool.

BTW were you saying that it works for you but not on friend's machine?
If so, what setup was he running on?

Also BTW, that EOF error you reported is similar to a symptom seen
only Windows, whichhas been fixed in the source tree:
http://www.nabble.com/AS3-library-under-windows-td19787488.html

Ben

Don-Duong Quach

unread,
Jan 6, 2009, 1:43:13 PM1/6/09
to as3-amqp-user
Hi Ben,

I think I've figured out what's causing the EOF error. I created a
test to send/receive a large message (greater than Connection#frameMax
or 2^16 bytes). When Flash receives a large message, only 2^16 bytes
are accessible at any time. So if you don't read all of the bytes
from the event then they are lost. The next onSocketData call
delivers a new batch of data, so subsequent calls to
Connection#parseFrame result in errors.

The fix was to create a ByteArray "frameBuffer" to store the available
socket bytes, and in the Frame#readFrom do a buffer check to see if
there are enough bytes to parse a complete Frame. After each Frame is
parsed, the frameBuffer can be resized. This solves the issue of
maintaining state between onSocketData / parseFrame calls.

With this fix in place, I don't see the errors anymore. I'm assuming
this will also fix the case of receiving many small messages that get
buffered up till 2^16 bytes which may cause a frame to get split.

Btw, I've converted the library from as3 to haXe (http://github.com/
geekrelief/hxamqp/tree/master) and made the fixes and other
modifications there. I can send you the code changes, but how would
you recommend I do that? Should I clone the as3-amqp repo and push
the modifications?

-Don Q.

On Nov 11 2008, 4:16 am, "Ben Hood" <0x6e6...@gmail.com> wrote:
> Don Q,
>
Reply all
Reply to author
Forward
0 new messages