TypeError: Error #1088: The markup in the document following the root element must be well-formed.
at it.gotoandplay.smartfoxserver::SmartFoxClient/xmlReceived()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleMessage()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleSocketData()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleUserVarsUpdate()
at Function/http://adobe.com/AS3/2006/builtin::apply()
at it.gotoandplay.smartfoxserver.handlers::SysHandler/handleMessage()
at it.gotoandplay.smartfoxserver::SmartFoxClient/xmlReceived()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleMessage()
at it.gotoandplay.smartfoxserver::SmartFoxClient/handleSocketData()
Hi,
it is likely that there is a mismatch between your current server version and the client API.
Please tell me which Server version and API version you are using.
API version is obtained by calling the getVersion() method on the SmartFoxClient instance.
I've install flash client V1.6.1,
but this bug didn't fix there.
Problem is in function xmlReceived(msg:String):void
Sometimes server send us wrong xml that contains two messages
The problem with this issues is the ability to reproduce them. We have had a few reports about a similar problem but we were never been able to reproduce it. It might be related with specific network conditions...
Personally I remember having a problem that was similar when stress testing an early version of SmartFox with a firewall in between. The firewall was working good 90% of the times but under very high traffic it would start messing around with packets resulting in sporadic errors in SFS. After multiple headaches we realized it was the firewall, we removed it and never had the problem again, plus we were able to add more pressure to the stress tests.
If you can provide any more information we are interested in learning more and see if we can help
This is really strange.
It is perfectly possible that 2 or more messages are aggregated in the same packet and the API handle this without problems.
Each message needs to be separated by the XMLSocket terminator byte (0x00) which marks the end of the message.
The API scan through the binary data and recreate messages by locating these end-of-message markers.
I have verified the code that does this in the API and it works correctly and I am not able to think of an exception where this might not work.
So one could hypothesize that the marker in between the two messages is not present, which is even more strange.
Since you are able to see these quite often, it would be great if you could capture one of these events and check the actual binary data.
If you want you can get in touch with me via email and I will provide some help to temporarily modify the Actionscript API in order to capture one these events.
I just want to add my 2 cents maybe it helps, this happens always when you don't handle your previous exceptions correctly. I am not saying that this may be your problem but to be sure always use debug player and check for unresolved exceptions inside your code. I am talking about all exceptions not only those inside your SFS code it can be inside your application something totally unrelated to SFS.
A lot of people let minor exceptions unresolved as a flash developer browsing Flash sites its quite often than i encounter various exceptions, mostly URLLoader ones. Why do people do this? ALWAYS handle all your possible exceptions, i know that the enduser without debug can't see them they DO break your application, this specific problem with SFS packets is one of them. If you run the debug is this the only exception you see? Its probably related to one that you got before it, i too had this problem quite a lot during game development but i never ever had this exception to pop up standalone.
Interesting post. However I am in trouble understanding this comment and I don't see how this could happen. Additionally the Flash Player is (thanks god) a single threaded environment so it's quite easy to follow the the code flow.
An error caused by your code will simply make the execution bubble up until a try/catch handler is found and eventually it will surface at the top as unhandled error if you run the debug player or it will be ignored by non-debug players.
This however will not hijack the normal execution of events fired by other objects such as the Mouse, Keyboard, Timers or the SmartFoxClient class.
In order to confirm this I have done a quick test with the AvatarChat example throwing an Error on each movement of the Avatar which results in an annoying popup in the standalone player. Besides that everything functions correctly even when running many clients all generating the error at runtime.
Lapo thats interesting, for example i had simple unresolved exception by URLLoader and right after that these SFS XML exceptions started. Once i resolved the URLLoader exception the SFS had no problem. However now i too tried to make some forced test exceptions and SFS had no problem, strange, if i encounter some scenario which can be easily reproduced i will let you know.
You are right about the single threaded enviroment ofcourse, even thou there were times when i was wishing that i could created multi threaded application atleast inside AIR. For example when i decided to use AS3 for Google CodeJAM competition
However now i too tried to make some forced test exceptions and SFS had no problem, strange, if i encounter some scenario which can be easily reproduced i will let you know.
That would be great.
For example when i decided to use AS3 for Google CodeJAM competition
Cool
Btw, Timers can be a good replacement for threads and they don't introduce the intricacies of Java.
Lapo wrote:Btw, Timers can be a good replacement for threads and they don't introduce the intricacies of Java.
I hope the offtopic isn't a bother. Anyway timers in AS3 still execute in the same thread which means they use the same CPU Core which was the problem since i run on Quad i wanted to utilize all 4 cores which isn't possible with Flash since it always runs only on 1 core
Hate to get between two gals chatting and going all on-topic, but there is some truth to this. Whenever I get an error in the debug-versioin of the flashplayer, all (or most) server XML messages cause more error-popups complaining about the XML markup.
However, this is not the case in the example from my previous post.
nizzle sorry for the offtopic, anyway good to know that i didn't have paranoia about the server XML messages going all crazy after some of the non-related Flash exceptions. Its also a hint for anyone else that has problems with this type of situation. Since i said i always had those errors only as a result of other non-related exceptions and SFS was all innocent in that scenario
Anyway any luck on reproducing the actual bug when it happens? I doubt the problem is in the XML you posted its probably somewhere in the client code.
Whenever I get an error in the debug-versioin of the flashplayer, all (or most) server XML messages cause more error-popups complaining about the XML markup.
If you can provide a simple example that reproduces the issue it would be great