Recordset.Open Causes Lockup/Timeout

Recordset.Open Causes Lockup/Timeout

am 28.11.2005 09:22:50 von lfree

Hi,

I was/am having a problem with a web hosting company (verio.com) running Windows
Server 2003. The problem is as follows:

The site I am working on (http://www.codebot.org) uses active server pages to loaded
up various rss feeds and parse them into pretty response documents. This works great
for server side xml requests when the request is outside of my domain, but when I
make a request within my domain (to the same server), the request for the xml
document timesout or locks the server.

So:

Client Browser requests Page "A"
Page "A" will request Page "B"
Page "B" builds and XML response and return it to Page "A"
Page "A" returns the final response to the Client Browser

You can see the result by visiting http://www.codebot.org "Most Popular Content" area

Here a concise version how Page "A" works:
/rss/test.asp on mydomain

<%@ language="jscript" %>
<%
function getRss(url) {
var xmlRequest = Server.CreateObject("Msxml2.ServerXMLHTTP");
var document = Server.CreateObject("Microsoft.XMLDOM.1.0");
var xml = "";
xmlRequest.open("GET", url, false);
xmlRequest.setRequestHeader("User-Agent",
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716
Firefox/1.0.6");
xmlRequest.setRequestHeader("Accept", "text/xml");
xmlRequest.send();
document.async = false;
document.load(xmlRequest.responseBody);
xml = document.xml;
xmlRequest = null;
document = null;
return xml;
}

Response.ContentType = "text/xml";
Response.Write(getRss("http://mydomain/rss/list.asp"));
%>

And Page "B":
/rss/list.asp on mydomain

<%@ language="jscript" %>
<%
var connection = Server.CreateObject("ADODB.Connection");
connection.Open("DSN=blah");
var recordset = Server.CreateObject("ADODB.Recordset");
recordset.ActiveConnection = connection;
recordset.Source = "select 'Hello World' as [result]";
recordset.Open();
Response.Write(recordset.Fields("result").Value);
recordset.Close();
recordset = null;
connection.Close();
connection = null;
%>

Obviously there is more to the pages than above, but these scripts duplicate the
problem.

I have tracked down the exact line where everything locks up. It's where I attempt to
open the recordset in Page "B". Just so you know, the DSN maps to an Access mdb file.

If I load Page "B" from the browser it works fine, but there is something about my
web host's configuration that causes the call to recordset.Open to lock the server
when called from Page "A".

On my home server I do not have this issue, so believe it has something to to with my
web host's configuration.

Could anyone please tell me why the second request fails when opening the recordset?

FWIW: I am able to get around the issue by writing Page "B" as an asp.net page.

Re: Recordset.Open Causes Lockup/Timeout

am 28.11.2005 22:42:06 von reb01501

boxboy wrote:
> Hi,
>
> I was/am having a problem with a web hosting company (verio.com)
> running Windows Server 2003. The problem is as follows:
>
> The site I am working on (http://www.codebot.org) uses active server
> pages to loaded up various rss feeds and parse them into pretty
> response documents. This works great for server side xml requests
> when the request is outside of my domain, but when I make a request
> within my domain (to the same server), the request for the xml
> document timesout or locks the server.
>
> So:
>
> Client Browser requests Page "A"
> Page "A" will request Page "B"
> Page "B" builds and XML response and return it to Page "A"
> Page "A" returns the final response to the Client Browser
>
> You can see the result by visiting http://www.codebot.org "Most
> Popular Content" area
>
> Here a concise version how Page "A" works:
> /rss/test.asp on mydomain
>
> <%@ language="jscript" %>
> <%
> function getRss(url) {
> var xmlRequest = Server.CreateObject("Msxml2.ServerXMLHTTP");
> var document = Server.CreateObject("Microsoft.XMLDOM.1.0");
> var xml = "";
> xmlRequest.open("GET", url, false);
> xmlRequest.setRequestHeader("User-Agent",
> "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10)
> Gecko/20050716 Firefox/1.0.6");
> xmlRequest.setRequestHeader("Accept", "text/xml");
> xmlRequest.send();
> document.async = false;
> document.load(xmlRequest.responseBody);
> xml = document.xml;
> xmlRequest = null;
> document = null;
> return xml;
> }
>
> Response.ContentType = "text/xml";
> Response.Write(getRss("http://mydomain/rss/list.asp"));
> %>
>
> And Page "B":
> /rss/list.asp on mydomain
>
> <%@ language="jscript" %>
> <%
> var connection = Server.CreateObject("ADODB.Connection");
> connection.Open("DSN=blah");
> var recordset = Server.CreateObject("ADODB.Recordset");
> recordset.ActiveConnection = connection;
> recordset.Source = "select 'Hello World' as [result]";
> recordset.Open();
> Response.Write(recordset.Fields("result").Value);
> recordset.Close();
> recordset = null;
> connection.Close();
> connection = null;
> %>
>
> Obviously there is more to the pages than above, but these scripts
> duplicate the problem.

I cannot reproduce this problem, but you may want to streamline your code a
little (for one thing, get rid of the DSN; for another, utilize the
responseXML object):

function getRss(url) {
var xmlRequest = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0");
var xml = "";
xmlRequest.open("GET", url, false);
xmlRequest.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U;
Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716;Firefox/1.0.6");
xmlRequest.setRequestHeader("Accept", "text/xml");
xmlRequest.send();
var document = xmlRequest.responseXML;
xml = document.xml;
xmlRequest = null;
document = null;
return xml;
}


<%@ language="jscript" %>
<%
var connection = Server.CreateObject("ADODB.Connection");
connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
+ Server.MapPath("thedatabase.mdb"));
var sql="select 'Hello World' as [result]"
var recordset = connection.Execute(sql,null,1);
Response.ContentType = "text/xml";
Response.Write(recordset(0).Value);
recordset.Close();
recordset = null;
connection.Close();
connection = null;
%>




--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: Recordset.Open Causes Lockup/Timeout

am 29.11.2005 00:39:35 von lfree

The code I provided was a concise version of what I have. In otherwords not exactly
the same. I was already using a provider and Server.MapPath to name the data source
in my real code, but was trimmed that out to prevent telling the world the file name
of my .mdb database.

Thanks for the tip on the responseXML property.

I did try the code you were nice enough to post, but get the same issue.

I have traced down the problem even further. Whenever a attempt to create any COM
object (Server.CreateObject) from the context of Page "B" called by Page "A" I get
the same error behaviour.

Again the error behaviour is that when loading Page "A" after a minute or so the
request timesout. Loading Page "B" directly from the browser works fine.

I tried putting error handling code around the calls, but it still fails.

Page "B":

<%@ language="jscript" %>
<%
Response.ContentType = "text/xml";
try {
// Any Server.CreateObject call will lock the machine
// when the request comes from the same server
var obj = Server.CreateObject("ADODB.Connection");
// Never gets to here
Response.Write("" + (obj == null?"null":"object") + "");
} catch(e) {
// Never gets to here either
Response.Write("" + e.name + "");
}
%>

This problem is only occuring on my web host's server where direct machine access is
not possible, so I am at a loss here.

Thanks for responding.

"Bob Barrows [MVP]" wrote in message
news:eTdbVSG9FHA.1028@TK2MSFTNGP11.phx.gbl...
> boxboy wrote:
>> Hi,
>>
>> I was/am having a problem with a web hosting company (verio.com)
>> running Windows Server 2003. The problem is as follows:
>>
>> The site I am working on (http://www.codebot.org) uses active server
>> pages to loaded up various rss feeds and parse them into pretty
>> response documents. This works great for server side xml requests
>> when the request is outside of my domain, but when I make a request
>> within my domain (to the same server), the request for the xml
>> document timesout or locks the server.
>>
>> So:
>>
>> Client Browser requests Page "A"
>> Page "A" will request Page "B"
>> Page "B" builds and XML response and return it to Page "A"
>> Page "A" returns the final response to the Client Browser
>>
>> You can see the result by visiting http://www.codebot.org "Most
>> Popular Content" area
>>
>> Here a concise version how Page "A" works:
>> /rss/test.asp on mydomain
>>
>> <%@ language="jscript" %>
>> <%
>> function getRss(url) {
>> var xmlRequest = Server.CreateObject("Msxml2.ServerXMLHTTP");
>> var document = Server.CreateObject("Microsoft.XMLDOM.1.0");
>> var xml = "";
>> xmlRequest.open("GET", url, false);
>> xmlRequest.setRequestHeader("User-Agent",
>> "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.10)
>> Gecko/20050716 Firefox/1.0.6");
>> xmlRequest.setRequestHeader("Accept", "text/xml");
>> xmlRequest.send();
>> document.async = false;
>> document.load(xmlRequest.responseBody);
>> xml = document.xml;
>> xmlRequest = null;
>> document = null;
>> return xml;
>> }
>>
>> Response.ContentType = "text/xml";
>> Response.Write(getRss("http://mydomain/rss/list.asp"));
>> %>
>>
>> And Page "B":
>> /rss/list.asp on mydomain
>>
>> <%@ language="jscript" %>
>> <%
>> var connection = Server.CreateObject("ADODB.Connection");
>> connection.Open("DSN=blah");
>> var recordset = Server.CreateObject("ADODB.Recordset");
>> recordset.ActiveConnection = connection;
>> recordset.Source = "select 'Hello World' as [result]";
>> recordset.Open();
>> Response.Write(recordset.Fields("result").Value);
>> recordset.Close();
>> recordset = null;
>> connection.Close();
>> connection = null;
>> %>
>>
>> Obviously there is more to the pages than above, but these scripts
>> duplicate the problem.
>
> I cannot reproduce this problem, but you may want to streamline your code a
> little (for one thing, get rid of the DSN; for another, utilize the
> responseXML object):
>
> function getRss(url) {
> var xmlRequest = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0");
> var xml = "";
> xmlRequest.open("GET", url, false);
> xmlRequest.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U;
> Windows NT 5.1; en-US; rv:1.7.10) Gecko/20050716;Firefox/1.0.6");
> xmlRequest.setRequestHeader("Accept", "text/xml");
> xmlRequest.send();
> var document = xmlRequest.responseXML;
> xml = document.xml;
> xmlRequest = null;
> document = null;
> return xml;
> }
>
>
> <%@ language="jscript" %>
> <%
> var connection = Server.CreateObject("ADODB.Connection");
> connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source="
> + Server.MapPath("thedatabase.mdb"));
> var sql="select 'Hello World' as [result]"
> var recordset = connection.Execute(sql,null,1);
> Response.ContentType = "text/xml";
> Response.Write(recordset(0).Value);
> recordset.Close();
> recordset = null;
> connection.Close();
> connection = null;
> %>
>
>
>
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

Re: Recordset.Open Causes Lockup/Timeout

am 29.11.2005 06:10:19 von lfree

Okay, I found this KB article:

http://support.microsoft.com/default.aspx?scid=kb;en-us;Q316 451

Hrmm. That sucks. Now I need to find a workaround.