| OLD | NEW |
| 1 # A Crash Course in Debugging with about:net-internals | 1 # A Crash Course in Debugging with about:net-internals |
| 2 | 2 |
| 3 This document is intended to help get people started debugging network errors | 3 This document is intended to help get people started debugging network errors |
| 4 with about:net-internals, with some commonly useful tips and tricks. This | 4 with about:net-internals, with some commonly useful tips and tricks. This |
| 5 document is aimed more at how to get started using some of its features to | 5 document is aimed more at how to get started using some of its features to |
| 6 investigate bug reports, rather than as a feature overview. | 6 investigate bug reports, rather than as a feature overview. |
| 7 | 7 |
| 8 It would probably be useful to read [life-of-a-url-request.md]( | 8 It would probably be useful to read |
| 9 life-of-a-url-request.md) before this document. | 9 [life-of-a-url-request.md](life-of-a-url-request.md) before this document. |
| 10 | 10 |
| 11 # What Data Net-Internals Contains | 11 # What Data Net-Internals Contains |
| 12 | 12 |
| 13 about:net-internals provides a view of browser activity from net/'s perspective. | 13 about:net-internals provides a view of browser activity from net/'s perspective. |
| 14 For this reason, it lacks knowledge of tabs, navigation, frames, resource types, | 14 For this reason, it lacks knowledge of tabs, navigation, frames, resource types, |
| 15 etc. | 15 etc. |
| 16 | 16 |
| 17 The top level network stack object is the URLRequestContext. The Events View | 17 The top level network stack object is the URLRequestContext. The Events View |
| 18 has information for all Chrome URLRequestContexts that are hooked up to the | 18 has information for all Chrome URLRequestContexts that are hooked up to the |
| 19 single, global, ChromeNetLog object. This includes both incognito and non- | 19 single, global, ChromeNetLog object. This includes both incognito and non- |
| 20 incognito profiles, among other things. The Events view only shows events for | 20 incognito profiles, among other things. The Events view only shows events for |
| 21 the period that net-internals was open and running, and is incrementally updated | 21 the period that net-internals was open and running, and is incrementally updated |
| 22 as events occur. The code attempts to add a top level event for URLRequests | 22 as events occur. The code attempts to add a top level event for URLRequests |
| 23 that were active when the tab was opened, to help debug hung requests, but | 23 that were active when the tab was opened, to help debug hung requests, but |
| 24 that's best-effort only, and only includes requests for the current profile and | 24 that's best-effort only, and only includes requests for the current profile and |
| 25 the system URLRequestContext. | 25 the system URLRequestContext. |
| 26 | 26 |
| 27 The other views are all snapshots of the current state of the main | 27 The other views are all snapshots of the current state of the main |
| 28 URLRequestContext's components, and are updated on a 5 second timer. These will | 28 URLRequestContext's components, and are updated on a 5 second timer. These will |
| 29 show objects that were created before about:net-internals was opened. Most | 29 show objects that were created before about:net-internals was opened. Most |
| 30 debugging is done with the Events view (which will be all this document | 30 debugging is done with the Events view (which will be all this document |
| 31 covers), but it's good to be aware of this distinction. | 31 covers), but it's good to be aware of this distinction. |
| 32 | 32 |
| 33 # Events vs Sources | 33 # Events vs Sources |
| 34 | 34 |
| 35 The Event View shows events logged by the NetLog. The NetLog model is that | 35 The Event View shows events logged by the NetLog. The NetLog model is that |
| 36 long-lived network stack objects, called sources, emit events over their | 36 long-lived network stack objects, called sources, emit events over their |
| 37 lifetime. Some events have a beginning and end point (during which other | 37 lifetime. When looking at the code, a "BoundNetLog" object contains a source |
| 38 subevents may occur), and some only occur at a single point in time. Generally | 38 ID, and a pointer to the NetLog the source emits events to. Some events have a |
| 39 only one event can be occuring for a source at a time. If there can be multiple | 39 beginning and end point (during which other subevents may occur), and some only |
| 40 events doing completely independent thing, the code often uses new sources to | 40 occur at a single point in time. Generally only one event can be occuring for a |
| 41 represent the parallelism. | 41 source at a time. If there can be multiple events doing completely independent |
| 42 thing, the code often uses new sources to represent the parallelism. |
| 42 | 43 |
| 43 "Sources" correspond to certain net objects, however, multiple layers of net/ | 44 "Sources" correspond to certain net objects, however, multiple layers of net/ |
| 44 will often log to a single source. Here are the main source types and what they | 45 will often log to a single source. Here are the main source types and what they |
| 45 include (Excluding HTTP2 [SPDY]/QUIC): | 46 include (Excluding HTTP2 [SPDY]/QUIC): |
| 46 | 47 |
| 47 * URL_REQUEST: This corresponds to the URLRequest object. It includes events | 48 * URL_REQUEST: This corresponds to the URLRequest object. It includes events |
| 48 from all the URLRequestJobs, HttpCache::Transactions, NetworkTransactions, | 49 from all the URLRequestJobs, HttpCache::Transactions, NetworkTransactions, |
| 49 HttpStreamFactoryImpl::Requests, HttpStream implementations, and | 50 HttpStreamFactoryImpl::Requests, HttpStream implementations, and |
| 50 HttpStreamParsers used to service a response. If the URL_REQUEST follows HTTP | 51 HttpStreamParsers used to service a response. If the URL_REQUEST follows HTTP |
| 51 redirects, it will include each redirect. This is a lot of stuff, but generally | 52 redirects, it will include each redirect. This is a lot of stuff, but generally |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 code or the exact URL of the resource that won't load, you can just search for | 93 code or the exact URL of the resource that won't load, you can just search for |
| 93 it. If it's an upload, you can search for "post", or if it's a redirect issue, | 94 it. If it's an upload, you can search for "post", or if it's a redirect issue, |
| 94 you can search for "redirect". However, you often won't have much information | 95 you can search for "redirect". However, you often won't have much information |
| 95 about the actual problem. There are two filters in net-internals that can help | 96 about the actual problem. There are two filters in net-internals that can help |
| 96 in a lot of cases: | 97 in a lot of cases: |
| 97 | 98 |
| 98 * "type:URL_REQUEST is:error" will restrict the list to URL_REQUEST object with | 99 * "type:URL_REQUEST is:error" will restrict the list to URL_REQUEST object with |
| 99 an error of some sort (red background). Cache errors are often non-fatal, so | 100 an error of some sort (red background). Cache errors are often non-fatal, so |
| 100 you should generally ignore those, and look for a more interesting one. | 101 you should generally ignore those, and look for a more interesting one. |
| 101 | 102 |
| 102 * "type:URL_REQUEST sort:duration" will show the lonest-lived requests (as of | 103 * "type:URL_REQUEST sort:duration" will show the longest-lived requests first. |
| 103 when about:net-internals was opened) first. This is often useful in finding | 104 This is often useful in finding hung or slow requests. |
| 104 hung or slow requests. | |
| 105 | 105 |
| 106 For a list of other filter commands, you can mouse over the question mark on | 106 For a list of other filter commands, you can mouse over the question mark on |
| 107 about:net-internals. | 107 about:net-internals. |
| 108 | 108 |
| 109 Once you locate the problematic request, the next is to figure out where the | 109 Once you locate the problematic request, the next is to figure out where the |
| 110 problem is - it's often one of the last events, though it could also be related | 110 problem is - it's often one of the last events, though it could also be related |
| 111 to response or request headers. You can use "source_dependency" links to drill | 111 to response or request headers. You can use "source_dependency" links to drill |
| 112 down into other related sources, or up from layers below URL_REQUEST. | 112 down into other related sources, or up from layers below URL_REQUEST. |
| 113 | 113 |
| 114 You can use the name of an event to search for the code responsible for that | 114 You can use the name of an event to search for the code responsible for that |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 things like HSTS redirects (URLRequestRedirectJob), AppCache, ServiceWorker, | 174 things like HSTS redirects (URLRequestRedirectJob), AppCache, ServiceWorker, |
| 175 etc. These generally don't log as much information, so it can be tricky to | 175 etc. These generally don't log as much information, so it can be tricky to |
| 176 figure out what's going on with these. | 176 figure out what's going on with these. |
| 177 | 177 |
| 178 * Non-HTTP requests also appear in the log, and also generally don't log much | 178 * Non-HTTP requests also appear in the log, and also generally don't log much |
| 179 (blob URLs, chrome URLs, etc). | 179 (blob URLs, chrome URLs, etc). |
| 180 | 180 |
| 181 * Preconnects create a "HTTP_STREAM_JOB" event that may create multiple | 181 * Preconnects create a "HTTP_STREAM_JOB" event that may create multiple |
| 182 CONNECT_JOBs (or none) and is then destroyed. These can be identified by the | 182 CONNECT_JOBs (or none) and is then destroyed. These can be identified by the |
| 183 "SOCKET_POOL_CONNECTING_N_SOCKETS" events. | 183 "SOCKET_POOL_CONNECTING_N_SOCKETS" events. |
| OLD | NEW |