Bug 11564

Summary: Connections stuck timing out, cannot be cancelled until timeout passes
Product: WebKit Reporter: Kevin M. Dean <kevin>
Component: Page LoadingAssignee: Nobody <webkit-unassigned>
Severity: Normal CC: dev+webkit, mrowe
Priority: P2    
Version: 420+   
Hardware: Macintosh PowerPC   
OS: OS X 10.4   
Description Flags
Sample of Final Activity Window none

Description Kevin M. Dean 2006-11-10 07:43:50 PST
I've been wanting to post this issue for a while, but I've been reluctant since it's not easy to reproduce. When I'm webdesigning I tend to refresh a lot and this is where it comes up most often.

I'm finding that if I refresh a page repeated one after the other eventually Safari or Webkit will just stop loading anything. This includes even stopping the page load and trying to load another site. It all just stops. I've also had this happen during normal (non-refreshing) page loading, possibly triggered by loading tabs and jumping to new tabs to load new pages before the previous tabs have finished loading.

Basically it appears that somewhere the ability to load content gets tied up. Maybe my refreshing of a page is overlapping a previous refresh or the new file I've uploaded hasn't fully saved to the server yet before I've refreshed. Maybe opening to many connections to close together is glitching. I really don't know and as I said it's a bit hard to pin down. I recommend trying to go to any site and refresh the page rapidly and even refresh before waiting for the previous one to load.
Comment 1 Matt Lilek 2006-11-13 10:35:47 PST
When this happens, does it not load anything at all or does it simply not display anything?  You can find this out by hitting View Source or opening the web inspector when this happens.  If the source is there and it simply does not display, then it sounds similar to bug 11590
Comment 2 Matt Lilek 2006-11-13 10:37:15 PST
Also, the summary mentions Safari/WebKit - does this only happen in the nighly builds or does this happen in shipping Safari too?
Comment 3 Kevin M. Dean 2006-11-13 10:48:51 PST
I'll have to check next time it happens for loading versus display.

It happens in Shipping Safari too.

I did have an incident this morning where I thought it was the same issue. Pages stopped loading, The activity window show cancelled on a bunch of items, but in about a minute or two it started loading pages again. I don't know if it was the same issue or not.
Comment 4 Kevin M. Dean 2006-11-13 14:04:57 PST
OK, it's definitely not loading. I just had it happen again and the page it happens on stops loading leaving cancelled messages in the Activity Window even thought the loading progress bar still shows the page as loading. During this you can open a new tab, but you cannot load any new content. This time I stopped the initial page that was loading and then after a little bit I was able to load pages again. It seems that when the loading of page elements gets messed up, returning cancelled messages, Safari's not finishing the page and closing connections. I presuming that all the connections are in use is why I cannot load new content until it clears itself.
Comment 5 Mark Rowe (bdash) 2006-12-05 19:29:48 PST
How are you testing this?  Is there a single URL that reliably reproduces the issue that you describe, or is it happening on all sites?
Comment 6 Kevin M. Dean 2006-12-05 19:52:42 PST
There's not a single url, it may just my browsing style exploits a problem. See, I don't always wait for a page to finish loading before clicking on a link to go somewhere else. This seems to sometimes cause the problem. Also, it happens quite often when I'm working on a site and option-refreshing a lot to force reload everything on the page. I don't think it's happened if I wait for a page to fully load before clicking another link. It sometimes also occurs if I open a new tab to go to a new bookmark before a previous tab is done loading. Maybe I just overlap things too much, but that seems to be the crux of the problem.
Comment 7 Mark Rowe (bdash) 2006-12-05 19:57:41 PST
Is there anything atypical about your network connection?  Are you behind a proxy server or anything like that?

While things are refusing to load, what does Safari's Activity window look like?  Are there any resources that are in the process of loading but have stalled?  Are there a large number showing up with errors?  A screenshot of this window while the problem occurs could be useful.
Comment 8 Kevin M. Dean 2006-12-05 20:08:57 PST
Nope, no proxy server or anything like that. Straight forward cable connection through a router.

As I mentioned in a previous comment, the activity window shows cancelled on various items belonging to the page it fails on even though the page is still trying to load and I didn't press the stop button. If I recall correctly, trying to load new pages in new tabs at this point don't result in anything more than the initial page line item in the activity window with the 0 bytes of ? I'll need to look again the next time it happens. I think I also have to click stop on the page with the cancelled items before regaining the ability to load pages, but this doesn't work immediately. It seems that after clicking stop I have to wait a minute or 2 before things work again. This why I previously thought it required a restart of Safari since I just wasn't waiting long enough to realize that it eventually works again.
Comment 9 Kevin M. Dean 2007-02-11 04:00:40 PST
Here's my latest assessment after watching things further with this issue.

When opening connections (possibly due to a large amount of images) the connections for some of the image files only get stuck on "0 bytes of ?". Eventually after about 30-60 seconds, the connections will switch to "timed out". At this time browsing can be resumed. If I press stop in my browser before "timed out" appears, the stuck items turn into "cancelled" but reloading of the page or even visiting a new site cannot be resumed until the original time out period passes. It seems at a minimum, stop a page load should clear any connections that are timing out. Of course it would be even better to figure out why the connections are failing in the first place.

It seems to happen most often when I'm working on a site and reloading a lot (although it did just happen again this morning on my first link to a site I've been working on). Maybe there's something going on when replacing cached content with newly downloaded content or mixing cached and fresh content.

The site I've been working on recently that has triggered it often is http://www.nationalsalute.com/ but as before I've found I can trigger it on any variety of site. It appears to be random in that it's not readily repeatable.
Comment 10 Kevin M. Dean 2007-02-11 04:04:25 PST
Created attachment 13117 [details]
Sample of Final Activity Window

I've attached the final view of my Activity Window after the connections have timed out. Maybe there's a pattern I don't see.
Comment 11 Mark Rowe (bdash) 2007-02-11 04:08:10 PST
If you're able to reproduce this easily enough it would be great if you could do a full packet dump of a short browsing session so that we can see what is happening at the TCP level with the connections.  You may need to provide extra details (such as, which of the requests is getting "stuck" so it's obvious which packets to look at). Seeing what is going on at the lower level may give us some indication of where to start looking to increase the reproducibility of the issue.
Comment 12 Kevin M. Dean 2007-02-11 04:28:16 PST
(In reply to comment #11)
> If you're able to reproduce this easily enough it would be great if you could
> do a full packet dump of a short browsing session so that we can see what is
> happening at the TCP level with the connections.

How do I go about doing that?

Comment 13 Mark Rowe (bdash) 2007-02-11 04:33:56 PST
I would generally do something like the following in Terminal:
sudo tcpdump -i en0 -s 0 -w packet-dump.dat host somehost.com and port 80

You'll need to tweak en0 depending on whether you're using wired or wireless network and somehost.com to be the site that's showing the problems.

One thing that's key here is to make it in some way obvious what is happening in the packet dump.  This may be as simple as waiting a decent length of time between page loads, and only doing a single page load at a time.  Obviously if either of these things interferes with reproducing the failures you should ignore this advice, but be sure to say as much when you attach the dump :)
Comment 14 Kevin M. Dean 2007-02-23 07:23:54 PST
OK, I started the packet-dump this morning when I began working on the site, so there's a lot of data restricted to just this site before it fails. The last thing in the dump is when I refreshed and it stalled. I allowed it to timeout the connections and then stopped the dump.

You can get the dump zipped up here... all 100 MB's worth.


If I catch another one, instead of waiting for the timeout, I'll try cancelling and loading new pages to see if it logs any different.
Comment 15 Kevin M. Dean 2007-02-25 09:04:00 PST
Here's the second dump.

It can be found at http://development.rhubarbproductions.com/webkit/

packet-dump2.zip - 20 MB

This time I cancelled the stalled page and then tried loading another page on the site (external pages fail too) and then waited until it loaded. In this case the second connection doesn't timeout. It eventually loads seemingly after the original stalled connections timeout even though they've been cancelled.