The Cache: Technology Expert's Forum
 
*
Welcome, Guest. Please login or register. January 07, 2009, 06:46:48 PM

Login with username, password and session length


Pages: 1 [2] 3
  Print  
Author Topic: XMLHttpRequest, IE6, SSL , and 12030 error - what is the solution?  (Read 8269 times)
elbarto
n00b
*
Offline Offline

Posts: 1



View Profile
« Reply #15 on: October 30, 2007, 12:16:48 PM »

Hi guys...
I joined the forum as is the only place where I found a deep analysis of this problem with IE.

I found out about this error a couple of weeks ago while reviewing a strange behavior on an application which seemed to randomly get sucked on a "loading" message. It turned out to be this 12030 error of IE (together with my lousy javascript programming skils Tongue ).

After reading the messages from this thread and this one, I decided to go with the iframes solution, so I coded a little class which emulates the XHR object using iframes and dynamic forms.

This went quite well (despite a couple of problems that I will try to fix later), but while I was testing my whole app again I found another error. There's a part of the site where users can upload an audio file. Of course this was never done with AJAX and worked with a hidden iframe from the begining. Now that I'm testing with IE I see from time to time when I try to upload a file that I get the feared ERROR_INTERNET_CONNECTION_ABORTED on my IEWebDeveloperV2 tab.

As you can imagine, this brings me two problems. First, the upload is not working. Second, if I'm having this problem with this iframe nothing assures me that my little class can't have the same problem (athough I haven't seen it yet).

Does anyone know anything about this error appearing in a non-ajax context? Anything might help me to figure out where I'm wrong.

Thanks in advance
Logged

El Barto
-----------
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #16 on: October 30, 2007, 03:56:54 PM »

Welcome to The Cache elBarto!

Man that sounds horrible - haven't seen that myself. Frigging IE...

since it's your little class doing this, and it's intermittent, I'd suggest writing some form of handshake so that you can see if it failed and then do it again... what a cluster.

Is there no possibility that you could simply do it with a form and a file type field... much like this very board does? I very rarely get problems with uploading that way and when I do it's almost 100% a firewall issue. Is there a specific reason that you must do the file upload outside of the normal structure of the page?

Good luck,
/p
Logged

If I can't be Mr. Root then I don't want to play.
djbiznatch
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #17 on: November 07, 2007, 09:44:58 AM »

Okay everyone, I'm struggling with the same problem right now...

My company uses primarily AJAX instead of form submits (does that make anyone cringe?) to pass data to our server.  We have some client side error/field checking going on, but then we also have potential database issues, so we AJAX submit our data, try to do *whatever* with it, and if we get any exceptions, they are passed back into the window which is eagerly waiting for a response.  If its a good response, we close the window.   If a bad response, we display an error message in a status area.  For awhile now, but more frequently as of late it seems, we've had an issue where the users have clicked 'Save' and it seems to hang in certain parts of our application. When we send the data, we lock the button so they get a javascript alert to ask them to please wait while its saving. However, minutes go by with no response, so the button remains locked, and they have to close out and come back to enter data again (and may very well have the same problem). 

We have a few different means of performing our AJX submits.. some of our code is using prototype.js's Ajax.Request object, and others are using a GET or POST method in an AJAXapi javascript object an old co-worker wrote. That was the first place I went to debug this problem, and sure enough, we were only handling a few expected response codes.  So we then found out we were getting the 12030 error, and in some cases 12029 (I believe).  The users seem to be experiencing the trouble only during POST submits (but the places we ARE using GET should really be POSTs).  I tried to modify the javascript to resend the request up to three times behind the scenes, hoping that the retry would work (since the error was sporadic).. problem is I can't test these changes easily myself, I have YET to replicate the problem on our system, or over VPN or on one of their terminal servers.  So I have to rely on the reports of annoyed customers! Sad  My changes did not work, so I have fallen back on throwing an error, which releases that save buttons lock, and lets them try to resend it themselves.  They seem to have luck with this, and can pretty consistently (I was led to believe) save the 2nd try.

I don't know what their IE security settings are, but shouldn't the error be consistent if thats a factor? Also, I think we have customers with the problem running both IE6 and IE7.  Many of our customers do NOT seem to have this issue, but I'm not sure if that has anything to do with what parts of our application they are using, or volumn of users, network configuration, yaddy yadda..

Heres the AJAXapi we use:

Code:
function AJAX(url, responseHandle) {
  this.url = url;
  var req = init();
  var isPost = false;
  var params = '';
  this.responseHandle = responseHandle;
  req.onreadystatechange = processRequest;

  function init() {
    if (window.XMLHttpRequest) {
      return new XMLHttpRequest();
    } else if (window.ActiveXObject) {
      isIE = true;
      return new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
   
  function processRequest () {
    if (req.readyState == 4) {
      if (req.status == 200) {
        if(responseHandle)
          eval(responseHandle + "(req.responseXML)");
        else
          postProcess(req.responseXML);
      } else if (req.status == 400) {
        if(responseHandle)
          eval(responseHandle + "(req.responseXML)");
        else
          postProcessError(req.getResponseHeader("SQL-Error"));
      } else if (req.status == 501) {
        if(responseHandle)
          eval(responseHandle + "(req.responseXML)");
        else
          postProcessMessage(req.getResponseHeader("GEN-Message"));
      } else {
        req = null;
        req = init();
        req.onreadystatechange = processRequest;

        if(isPost)
          this.sendpost(params);
        else
          this.send();
      }
    }
  }

  this.send = function() {
    isPost = false;
    req.open("GET", url, true);
    req.send(null);
  }

  this.sendpost = function( parameters ) {
    isPost = true;
    params = parameters;
    req.open( "POST", url, true );
    req.setRequestHeader( "Content-type","application/x-www-form-urlencoded" );
    req.setRequestHeader( "Content-length", parameters.length );
    req.setRequestHeader( "Connection", "close" );
    req.send( parameters );
  }   
}

Now we just send the processError() anytime we get a status we didn't expect. I actually had to rewrite some of these changes from memory but I think this is how it was trying to work.. although I'm wondering if saving the POST parameters was written like that..  at one customer they are able to save a second time and its fine (I don't know what is done any differently in clicking Save again and what I tried here), they are the ones that saw the 12030 error. Now I'm hearing that this ISNT working for the other customer, where we saw 12029 (or maybe 12031, i think its the CONNECTION_FAILED one).. So I wonder if theyre timing out somewhere or just flat out not getting a response..

Here's a sample of how we're sending data with the sendpost(params) method:

Code:

var AJAX = null;
var saving = false;

function save() { // this is a bogus function i just removed alot of extraneous code
  saving = true;

  var varURL = '<%=pusgActionURL%>/SaveController' // fake controller name
  var varParams = 'action=<%= prsgAction %>&clientID=<%= prsgClientId %>'; // there would be alot more data here
  ajax = new AJAX(varURL);
  ajax.sendpost(varParams);
}

function postProcess(response) {
  if (window.opener && !window.opener.closed)
    window.opener.refreshGrid();
  window.close();
  ajax = null;
  saving = false;  //the flag that locked the save button
}

function postProcessError(error) {
  document.getElementById('feedback').style.color = red;
  document.getElementById('feedback').innerHTML = "ERROR: " + error;
  ajax = null;
  saving = false; //the flag that locked the save button
}
   

Any help would be greatly appreciated.. we need a quick fix on this api if we can now, and then maybe change our method in the long run.. Thanks in advance for any responses
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #18 on: November 07, 2007, 11:09:22 AM »

Heyya DJ - Welcome to The Cache!

First off, your tale of woe is just so very common now... if you've read all the threads and posts even here on this issue you can see all the different ways that people are trying to solve it - and nothing just yet.

A couple things that seem to be standard for us: we only get it on HTTPS, not HTTP. However, we don't do anywhere near the same volume of unsecured ajax that we do secured, so I am no longer convinced that this is a reliable symptom. There are more error numbers, 12029, 12030, 12032 plus several more if you choose to search about here on the board.

If you look in the javascript code repository, you can see my personal JS class for request/response which I am now getting pretty close to working reliably - very few errors any more. However, I believe that this is simply good symptom handling, rather than fixing the root cause.

Interestingly, just the other day I posted in another thread on this issue about the possibility that we've all been looking in the wrong place. We've been focused on the request being bad - a new notion is that the *previous* request did not close, and the XMLHTTPRequest in IE only doesn't know how to handle it. The thinking was to add Connection: Close to the outbound packet, which explicitly closes out the request. Although I have no data yet, this is the first time I've seen something more outside the box and it actually makes a bit of sense to me.

Looking over your code briefly, you have a very straight-up JS requestor and there's nothing that sticks out to me. If you look at the Ajax Requestor class in the Javascript Code Repository, although you will find it much larger, I think you will see that the essential logic is all the same.

PLEASE let us know if you try any of the techniques here and get some success - everyone watching these threads is pretty equally frustrated.

Again, welcome to the cache.
/p
Logged

If I can't be Mr. Root then I don't want to play.
Dragonlaird
Rookie
**
Offline Offline

Posts: 15


Working with AJAX before it even had a name...


View Profile
« Reply #19 on: November 08, 2007, 12:02:30 AM »


We've been focused on the request being bad - a new notion is that the *previous* request did not close, and the XMLHTTPRequest in IE only doesn't know how to handle it.


That fits fairly square in the hole for me Perk, although I maintain that the POST request (still can't reproduce the problem with simple GET requests) was badly formed (due to incorrect headers, malformed addresses, invalid POST data etc) which is what causes the request to fail and MS didn't write the code to handle such a situation, hence it simply bombs and forgets to close the connection cleanly.

Eventually the ActiveX object is unloaded by IE during it's occasional clean up (usually about a minute or so later) and the problem disappears for a while until it experiences another badly formed request.

Belts and braces people, if you don't dot your I's and cross your T's, MS won't let you pass...

How about we examine the RFCs for accurate info on everything we must set to submit a POST(via HTTP and SSL)  request and ensure we follow it to the letter?
Logged

I may know what I'm doing but don't call me an expert...

An 'ex' is a has-been and a 'spurt' is a drip under pressure!
djbiznatch
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #20 on: November 08, 2007, 03:45:15 PM »

Out of curiosity, is anyone using the Ajax.Request from prototype.js and having this problem? I was going to try ousting our current ajax javascript in favor of that in a few of these problematic areas and see if that cleared up the problem at all.. I'm wondering if it handles things better or if its just a coincidence that we aren't see this problem in the areas we are using prototype...
Logged
Dragonlaird
Rookie
**
Offline Offline

Posts: 15


Working with AJAX before it even had a name...


View Profile
« Reply #21 on: November 09, 2007, 02:43:48 PM »

I'd be lying if I said I was, I published some code earlier in this thread that I've been testing to death with about a dozen or so machines now running various OSes and Browsers, including several versions of IE... You're welcome to give it a try in your environment and see if it cures your problem... Would be nice to get some feedback from a real-world environment...

http://www.perkiset.org/forum/ajax/xmlhttprequest_ie6_ssl_and_12030_error_what_is_the_solution-t442.0.html;msg3764#msg3764
Logged

I may know what I'm doing but don't call me an expert...

An 'ex' is a has-been and a 'spurt' is a drip under pressure!
pruzze
n00b
*
Offline Offline

Posts: 4


View Profile WWW
« Reply #22 on: December 05, 2007, 08:02:23 AM »

Out of curiosity, is anyone using the Ajax.Request from prototype.js and having this problem? I was going to try ousting our current ajax javascript in favor of that in a few of these problematic areas and see if that cleared up the problem at all.. I'm wondering if it handles things better or if its just a coincidence that we aren't see this problem in the areas we are using prototype...

We're using prototype, and we still get this problem with IE6 over SSL  Sad

/Fredrik Prüzelius
www dot dse dot se
« Last Edit: December 09, 2007, 02:44:40 PM by perkiset » Logged
Hannnibal
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #23 on: December 06, 2007, 03:03:27 PM »

From the other 12030 thread.
Please look here for a good explination of the problem: <edit - removed external link>

/Fredrik Prüzelius
www dot dse dot se

We have been experiencing the 12030 problem as well.  Perkiset, your observation about the previous request socket remaining open is consistent with what we saw during out examination of the problem.  I believe adding Connection : close to the header ensures that that the socket will close.  It does disable the Keep alive functionality which will add a little overhead but as the article that Fredrik posted stated, the server has already closed that socket anyway.  We altered our Prototype file to include Connection : close on the header for all POST actions and that seemed to mitigate the 12030 problem.....

Until this afternoon when it a tester saw it again (and only once the entire day) in our non-SSL integration environment.  The error has not been seen again but we added some retry code to the Prototype framework to reissue the request on a 12030 error and log the error just in case.  If it happens again, we'll know about it.  In the meanwhile I've been playing with Dragonlaird's header code.  I am unable to set the Content-Length header.  Everytime I set it and make the ajax call, the captured header seems to have been overwritten with the length of the parameters string I passed in.  I have a few ideas regarding the content-length being out of sync with the real length of the body but I'm unable to test it because I can not seem to manually set the Content-Length header.  Dragonliard, could you post a little code demonstrating your method for manually setting the Content-Length?  I would greatly appreciate it.
« Last Edit: December 09, 2007, 03:03:02 PM by perkiset » Logged
Hannnibal
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #24 on: December 06, 2007, 03:07:04 PM »

Sorry Dragonliard, I see you posted your code in another thread.
Logged
pruzze
n00b
*
Offline Offline

Posts: 4


View Profile WWW
« Reply #25 on: December 10, 2007, 05:29:27 AM »

We altered our Prototype file to include Connection : close on the header for all POST actions and that seemed to mitigate the 12030 problem.....

We're using prototype, and made the a fix in our own framework that is build on top of prototype, but it would be nicer to make the fix in prototype it self.  Could you post the patch here?

/Fredrik
Logged
djbiznatch
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #26 on: December 13, 2007, 06:57:18 AM »

just so you all know, i did make the switch to using prototype and it seems to have resolved our problems.  our customers are using a mix between IE6 and 7, but I don't think anyone is using SSL.  If they were, I guess we might still see the problem.. but for now I'm happy!
Logged
Hannnibal
n00b
*
Offline Offline

Posts: 3


View Profile
« Reply #27 on: December 13, 2007, 11:41:57 AM »

The prototype files are rather large but the change was quite simple.  I'm not sure which version you are using (I think we are using 1.4 for some crazy reason).  In the Ajax.Request.setRequestHeaders function add the line          requestHeaders.push('Connection', 'close'); to the if statement that sets some headers if you are performing a post action.

Logged
kjohnston
n00b
*
Offline Offline

Posts: 4


View Profile
« Reply #28 on: December 27, 2007, 10:03:08 AM »

Hey all - I just wanted to chime and say yes - adding "Connection: close" to every request does work.  I actually posted this solution in this same thread a while back - and I hadn't revisited this forum until I got the "happy holidays" email. :-)

Since adding the Connection: close to every SSL Ajax request, I have not seen the dreaded 12030 error one single time, on either IE6 or IE7 - and this is on a product that has now been through many QA cycles.

The only drawback to this solution is that there might be a slight performance hit - as this prevents IE from reusing the same SSL socket on a subsequent request.
Logged
perkiset
Olde World Hacker
Administrator
Lifer
*****
Online Online

Posts: 5324


:sniffle: Humor was so much easier before.


View Profile
« Reply #29 on: December 28, 2007, 05:31:36 PM »

Man that is JUST the kind of corroboration I've been looking for... right on KJ. Think it's time to revisit that whole side of things...
Logged

If I can't be Mr. Root then I don't want to play.
Pages: 1 [2] 3
  Print  
 
Jump to:  

Perkiset's Place Home   Best of The Cache   phpMyIDE: MySQL Stored Procedures, Functions & Triggers
Politics @ Perkiset's   Pinkhat's Perspective   
cache
mart
coder
programmers
ajax
php
javascript
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks


Valid XHTML 1.0! Valid CSS!