Thanks for looking into this Giorgio. Just to confirm, you tested either with localhost or on the LAN? Also, you're testing with refresh requests (F5 or refresh button)? The problem doesn't happen consistently so it may take many attempts before it occurs.
I looked into the code a bit and I think I've tracked down where the duplicate request originates from. In ABE.checkRequest() a call is made to this.deferIfNeeded(req). My particular request passes over the first if statement in deferIfNeeded() which deals with DNS and then IOUtil.runWhenPending(req.channel, <callback function>) is called. In the passed callback function, a replacement request is made:
Code: Select all
req.replace(false, null, function(replacement) {
ABE.log(host + " not cached in DNS, deferring ABE checks after DNS resolution for request " + req.serial);
DNS.resolve(host, 0, function(dnsRecord) {
replacement.open();
});
});
This results in a channel replacement:
Code: Select all
new ChannelReplacement(this.channel, null, false).replace(null, <callback function>);
At this point, a duplicate channel is created and the old channel is passed to IOUtil.runWhenPending with the following callback function:
Code: Select all
function() {
if (oldChan.status) return; // channel's doom had been already defined
let ccl = new CtxCapturingListener(oldChan,
function() {
try {
callback(self._replaceNow(isRedir, this))
} catch (e) {
self.dispose();
}
});
self.loadGroup = oldChan.loadGroup;
oldChan.loadGroup = null; // prevents the wheel from stopping spinning
// this calls asyncAbort, which calls onStartRequest on our listener
oldChan.cancel(NS_BINDING_REDIRECTED);
}
It checks if the channel already has a status code. If it doesn't, oldChan.cancel() is called which presumably kills the channel.
This killing of the original channel is exactly what I'm seeing. The first request dies with a broken pipe and the second request finishes. Here is the output when I use python's SimpleHTTPServer:
Code: Select all
localhost - - [26/May/2011 11:32:29] "GET / HTTP/1.1" 200 -
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 45734)
Traceback (most recent call last):
File "/usr/local/products/python/2.5.2/lib/python2.5/SocketServer.py", line 222, in handle_request
self.process_request(request, client_address)
File "/usr/local/products/python/2.5.2/lib/python2.5/SocketServer.py", line 241, in process_request
self.finish_request(request, client_address)
File "/usr/local/products/python/2.5.2/lib/python2.5/SocketServer.py", line 254, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/local/products/python/2.5.2/lib/python2.5/SocketServer.py", line 522, in __init__
self.handle()
File "/usr/local/products/python/2.5.2/lib/python2.5/BaseHTTPServer.py", line 316, in handle
self.handle_one_request()
File "/usr/local/products/python/2.5.2/lib/python2.5/BaseHTTPServer.py", line 310, in handle_one_request
method()
File "/.auto_direct/_usr_local/products/python/2.5.2/lib/python2.5/SimpleHTTPServer.py", line 44, in do_GET
f = self.send_head()
File "/.auto_direct/_usr_local/products/python/2.5.2/lib/python2.5/SimpleHTTPServer.py", line 81, in send_head
return self.list_directory(path)
File "/.auto_direct/_usr_local/products/python/2.5.2/lib/python2.5/SimpleHTTPServer.py", line 134, in list_directory
self.send_response(200)
File "/usr/local/products/python/2.5.2/lib/python2.5/BaseHTTPServer.py", line 370, in send_response
self.send_header('Server', self.version_string())
File "/usr/local/products/python/2.5.2/lib/python2.5/BaseHTTPServer.py", line 376, in send_header
self.wfile.write("%s: %s\r\n" % (keyword, value))
File "/usr/local/products/python/2.5.2/lib/python2.5/socket.py", line 262, in write
self.flush()
File "/usr/local/products/python/2.5.2/lib/python2.5/socket.py", line 249, in flush
self._sock.sendall(buffer)
error: (32, 'Broken pipe')
----------------------------------------
localhost - - [26/May/2011 11:32:29] "GET / HTTP/1.1" 200 -
The first request appears to be killed by the client resulting in a broken pipe. The second one completes. This also results in the "undefined" status code that appears in FF's Web Console (see my first post).
Can you look into this a bit further? I'm not really sure why the channel replacement needs to occur. In ABE.deferIfNeeded(), is the fact that I'm working on the LAN the cause of bypassing the first if statement dealing with DNS?
Any help is appreciated.