Jump to content
GreenSock

teugene

"noCache" DataLoader problem

Recommended Posts

Hi Jack,

 

I had encounter a problem regarding the noCache parameter used in DataLoader class. It was working perfectly until I used the recent version of LoaderMax and I've been getting errors since then. After doing some tests and reverting to previous LoaderMax versions, below is a sample of what I've found out:

 

Last working version - 2010-09-22 (LoaderMax 1.5):

http://web.com/file.php?do=getData&cach ... 7655795263

 

Updated version - 2010-10-13 (LoaderMax 1.631):

http://web.com/file.php?do=getDatacache ... 7655795263

 

If you noticed, the "&" separator is now missing from the "cacheBusterID" variable. From the changelogs, my guess is this bug was introduced in version 1.61 or 1.62 but I can't be sure as I don't have the versions between 1.5 and 1.631.

 

Thanks for your help.

Link to comment
Share on other sites

Would you be able to post a sample FLA that reproduces the issue? I actually implemented a fix after v1.5 that worked around a Flash bug that caused missing "&" signs in certain situations and several users have said it indeed worked well so I'm a bit baffled to hear that you're having that problem now. It'd be super helpful in terms of troubleshooting if you could post a very simple file (the simpler the better) that clearly demonstrates the issue.

 

Thanks in advance.

 

EDIT: Nevermind, I think I tracked down the issue...stand by...

Link to comment
Share on other sites

Example code below is the simplest script that can reproduce the problem. Also, I noticed that this will cause the same issue when LoaderMax is doing file size audit.

 

var someName:String = "greensock";
var loader:DataLoader = new DataLoader("http://sample.com/example.php?do=getStuffs&name="+someValue, {noCache: true, onComplete: doSomeFunction});
loader.load();

Link to comment
Share on other sites

Yep, the fix applied in 1.62 addressed part of the issue (a bug in Flash's URLRequest class) but not all of it - I just posted version 1.641 that should fully resolve it. Please give it a shot and let me know if it works well for you.

Link to comment
Share on other sites

Hi Jack, thanks for your prompt reply. However, the latest patch did not fix it but instead, I get another problem. When I compile the SWF in the IDE using the same example code above, it works perfectly, but not in Firefox (3.6.11) and the HTTP tracer (I'm using HttpFox FF plugin) shows the following :

 

 

The "?" has disappeared altogether. It doesn't matter if noCache parameter is true or false. The same problem happens in IE8, but it works in Chrome 7. However, our product uses the Firefox browser, hence I can't use this latest patch in our development. Thanks again in advance for your hard work to solve this problem.

Link to comment
Share on other sites

I cannot for the life of me reproduce that behavior - I tried following your instructions too (Firefox 3.6.11, watch with HttpFox) but it worked perfectly. No missing "?". For the record, LoaderMax isn't the thing that is responsible for putting that "?" in place - Flash's URLRequest does. All of the variables/parameters are put into a URLVariables object because that's the "proper" way to do it. Flash handles sending them as GET URL parameters - maybe you've got a corrupt Flash Player install? I'm grasping at straws here. What platform are you on? Can you walk me through every possible variable so that I can make sure I'm reproducing EXACTLY what you're doing to see the problem? If you could even post a sample FLA with the classes all zipped up together so that I can just open the file and publish it on my end, that'd be swell.

Link to comment
Share on other sites

The example code above is the simplest script line I used to reproduce the issue. Nothing fanciful. After doing more checks, I think I know why you can't seem to reproduce the error. My Chrome Flash player was 10.1 while the version on my IE was 9 and my FF was 10.0.45. After updating both IE and FF browser Flash Player to 10.1.83, the problems were gone. So my bet is that it is a problem with the Flash Player which could be solved with the latest player.

 

However, updating the Flash Player isn't an option now as all our systems are using 10.0.45 and we will not be deploying a Flash player update to all our systems located worldwide any time soon. Hence, my FF is still using a previous player version for development purposes. So the only other option at the moment is to stick to an older greensock.swc version until either the player is updated or a fix could be done. Thanks again for your assistance Jack.

Link to comment
Share on other sites

Ugh, don't you love Flash Player bugs like this?

 

It's rather tricky because the old version you're using just didn't mess with the regular URL but if you add any URLVariables to your request that you feed in to the DataLoader (or whatever), Flash would neglect to add the appropriate "&" delimiter to the URL. I worked around that in v1.62 but as you discovered, apparently certain versions of Flash don't append URLVariables properly to the URL string (well, it forgets to add the "?"). Version 1.641 applies an even more comprehensive workaround but it sounds like your older version of Flash still has problems (although I haven't verified that it's truly an issue with all 10.045 players - have you tried it on multiple machines?)

 

I'd also be curious to know whether it works for you if you use URLVariables instead of trying to tack those parameters to the end of the URL string. Kinda like:

 

OLD:

var dl:DataLoader = new DataLoader("http://greensock.com/index.php?v1=test1&v2=test2", {noCache:true});

 

NEW:

var request:URLRequest = new URLRequest("http://greensock.com/index.php");
var params:URLVariables = new URLVariables();
params.v1 = "test1";
params.v2 = "test2";
request.data = params;
var dl:DataLoader = new DataLoader(request, {noCache:true});

 

I'm guessing that won't make a difference, but I'd appreciate it if you'd give it a shot.

Link to comment
Share on other sites

Heh, sometimes I get my head scratching all day figuring out a problem or an issue that I had seemingly fixed but still causing the same issue all over again. Oh the joys of Flash. ;)

 

So I tried both the ways you asked on Chrome 7 (10.1) and FF3.6 (10.0.45), lo and behold, using the URLVariables way does not reproduce the problem, while the String way have an issue in FF3.6 10.0.45. I could convert those codes to use URLVariables way but there's tens and tens of codes to change, not to mention making the code a little more verbose than the one-liner it is now. The reason it was in a String way is because I was previously using my custom loaders to accomplish this until I switched all to use the DataLoader classes, hence I did not spend much time to convert using the URLVariables way.

Link to comment
Share on other sites

Hmm...I'm perplexed - you're sure you've got version 1.641 of com.greensock.loading.core.LoaderItem, right? If so, that should automatically translate your old stuff ("...index.php?do=getStuff&name=greensock") to the URLVariables way of doing things. So if you're saying that it works for you when you directly create the URLVariables, it should also work with the new version because it does that for you. Check out the code for yourself, add trace()s, etc. - I think you'll see that the logic flows correctly.

 

Again, it would be amazingly helpful if you could provide a full set of sample files (nothing fancy - just super simple) that can be published and run in the various browsers/FP versions to reproduce the issue. Again, please include your GreenSock classes too so that I can verify you've got the latest. I also need to know what platform you're on.

Link to comment
Share on other sites

I will try to get a script sample for you but I'm not at work now where my files and test environments are. It's also very late now (GMT+8), so I guess I'll do one over the next day. And we use java servlets to process HTTP requests (though I don't think that's an issue). Do you need a sample of the servlets as well or will an AS script sample do just fine?

Link to comment
Share on other sites

I don't care about the server-side stuff. I just need to see the requests going out incorrectly from Flash. Thanks!

Link to comment
Share on other sites

Hi Jack, sorry for the delayed response as I away during the weekends. Anyway, I had the files attached inside the zip file with the last working version of LoaderMax and the recent version of LoaderMax. As previously mentioned, the one-liner style is used in our project which doesn't work with the latest version of LoaderMax.

Link to comment
Share on other sites

Hmmm...a couple of problems with your sample:

 

1) The url you provided seems to be bad. I tried hitting it directly with the browser several times and got no response from the server. That would certainly explain why LoaderMax can't seem to load it :)

 

2) In the one-liner code, you have action=SetSession but in the URLVariables one, you have action=LoginServlet. Please make sure you're comparing apples-to-apples. Which one should be used?

Link to comment
Share on other sites

Apologies for the minor error. In haste, I copy pasted the wrong one. It's meant to be "SetSession". Despite that, it still doesn't work.

 

Anyway, I reattached the files with the minor correction and some tweaks to see a clearer distinction between the two loaders. Also, it is meant to work within a private local network thus we do not have a public address available. Nevertheless the swf included is compiled in LoaderMax 1.641 and a HTTP trace in a Flash player 10.0 shows one of the requests is missing a "?". However the same file on another PC with Firefox and Flash player 10.1 but doesn't exhibit the same issue.

Link to comment
Share on other sites

Hi Jack, I appreciate if I could get a reply for this issue. if this isn't resolved, I can't use the latest versions of your classes which is a shame since we paid to be a greensock club member to use all the excellent classes you have here.

Link to comment
Share on other sites

Absolutely. I've spent hours trying to chase this down and it is most DEFINITELY a bug in [certain older versions of] the Flash Player, not LoaderMax. I'm just trying to figure out the best workaround right now. The way Flash is behaving with a certain line of code is absolutely baffling - never seen something like this before. I'll try to track down one of Adobe's engineers who works on the Player to look at this. Stand by for a solution...

Link to comment
Share on other sites

Hi,

I came across the same problem today in a project. The "?" was just killed bi the DataLoader after i downloaded the latest greensock package. It's Windows, Firefox 3.6.11, Flash 10,0,32,18 Debug Version. Unfortunately i just have too little time to build an example, i hope i can do it later. I'd love to use your great LoaderMax, but for now i had to deactivate it not to worry my client.

But apart from that your library is really great!

Link to comment
Share on other sites

btw, i then replaced the DataLoader with a native URLLoader which then works with the "?". I think you also use a URLLoader, right?

Link to comment
Share on other sites

btw, i then replaced the DataLoader with a native URLLoader which then works with the "?". I think you also use a URLLoader, right?

Yep, I sure do. Like I said, this is probably the strangest bug I've ever seen in the Flash Player. Here's how you can reproduce it with your own Loader:

 

var url:String = "http://www.greensock.com/index.php?var1=1&var2=2";
var a:Array = url.split("?");
var request:URLRequest = new URLRequest();
request.url = a[0];
var params:URLVariables = new URLVariables();
params.action = "SetSession";
params.langId = 1;
request.data = params;
var loader:Loader = new Loader();
loader.load(request);

 

The issue has to do with doing any kind of manipulation on the String that defines the URL (in this case, the "url" variable). If you hard-code the URLRequest's url property, it works fine. If you manually populate the "a" array like a = ["http://www.greensock.com/index.php"], it works fine. But if you do split("?") or substr() or slice() or any other strategy for cutting off the extra parameters at the end and then apply that new String to the URLRequest's url property, it will choke (well, it omits the "?" like you saw in certain versions of the Flash Player). You can even verify that a[0] == "http://www.greensock.com/index.php" and it will return true! So it's the same value, but one of them causes trouble while the other doesn't! Unbelievable, huh?

 

I tracked down one of the Flash engineers at Adobe MAX today and he was equally baffled.

 

After many hours of trying different techniques, however, I believe I figured out a workaround. I'm traveling but hope to post an update to the main zip late tomorrow or early Friday. Thanks for your patience. Stand by...

Link to comment
Share on other sites

ah, indeed very amazing! Anyway thanks so much for all your effort!

Link to comment
Share on other sites

Thanks Jack for your superb effort! I never expect a simple error could be as bewildering as this too... :?

Link to comment
Share on other sites

Okay, I just posted an update and I believe it successfully works around the Flash bug. Please take a peek and let me know if it works well for you guys. http://www.LoaderMax.com

Link to comment
Share on other sites

I've tested the latest update and seems to be working smoothly! Woohoo! I'll update here again if I come across any issues again. Thanks Jack!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×