From: Ron M. Z. <ro...@ze...> - 2014-11-12 03:52:51
|
I've just recently started getting these weird "The underlying connection was closed: A connection that was expected to be kept alive was closed by the server" errors when talking to a Stardog database. Here are the particulars: - Mostly happens when the Stardog database is on a remote server - in this case when I'm at home and querying a Windows 2012 server hosted at Azure. When talking to the database locally from the same box (at Azure) it rarely exhibits this behavior. - Same thing happens if I query Stardog on a Linux server at Azure - If I use a proxy between dotNetRDF and Stardog - like Fiddler - to examine what's going on, it always works! But stop using the proxy and it fails. Which makes it hard to diagnose. - It only seems to fail when the SPARQL query is long and a POST is necessary. GETs for query queries don't seem to fail. After playing around and Googling for a while, I found this post ( http://stackoverflow.com/questions/13188058/httpwebrequest-the-underlying-connection-was-closed) that suggested setting these options in the WebRequest: request.KeepAlive = false; request.ProtocolVersion = HttpVersion.Version10; I added this to the CreateRequest function in BaseStardogConnector and it seems to have fixed the problem! So three questions: 1- Anyone have any ideas why this problem would seem to start for no reason, after it'd been working fine for months? 2- Any idea why proxying through Fiddler would hide the problem? Shouldn't it be passing the request straight through? 3- Is there any reason we shouldn't merge these changes into the codebase? - Ron |