[
https://issues.apache.org/jira/browse/TS-4316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15474233#comment-15474233
]
Alan M. Carroll commented on TS-4316:
-------------------------------------
In that particular case the "Accept" header is stored in a slot past 13 (it's
not necessarily in 14, it might be in 18 for instance, but certainly beyond
what 4 bits can index). But that's very dependent on the ordering and number of
headers in this specific request. For example, if the request had only 10
headers none would be stored in slots past 9. The question is not whether this
occurs, but how often. Is this rare or common?
Here is an example where "Accept" is stored in slot 2 -
{code}
(gdb) p *mh
$2 = {<HdrHeapObjImpl> = {m_type = 4, m_length = 592, m_obj_flags = 0},
m_presence_bits = 2252899342090241, m_slot_accelerators = {
4294967282, 4294967295, 1073741823, 4294049791}, m_cooked_stuff =
{m_cache_control = {m_mask = 0, m_secs_max_age = 0,
m_secs_s_maxage = 0, m_secs_max_stale = 0, m_secs_min_fresh = 0},
m_pragma = {m_no_cache = false}},
m_fblock_list_tail = 0x7ffff00a28f8, m_first_fblock = {<HdrHeapObjImpl> =
{m_type = 5, m_length = 528, m_obj_flags = 0},
m_freetop = 4, m_next = 0x0, m_field_slots = {{
m_ptr_name = 0x7fffc408f028 "Host: scrapyard\r\nUser-Agent:
curl/7.43.0\r\nAccept: */*\r\nProxy-Connection:
Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276",
<incomplete sequence \357>...,
m_ptr_value = 0x7fffc408f02e "scrapyard\r\nUser-Agent:
curl/7.43.0\r\nAccept: */*\r\nProxy-Connection:
Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ"...,
m_next_dup = 0x0, m_wks_idx = 30, m_len_name = 4, m_len_value = 9,
m_n_v_raw_printable = 1 '\001',
m_n_v_raw_printable_pad = 4 '\004', m_readiness = 2 '\002', m_flags = 1
'\001'}, {
m_ptr_name = 0x7fffc408f039 "User-Agent: curl/7.43.0\r\nAccept:
*/*\r\nProxy-Connection:
Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357",
<incomplete sequence \336>...,
m_ptr_value = 0x7fffc408f045 "curl/7.43.0\r\nAccept:
*/*\r\nProxy-Connection:
Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357",
<incomplete sequence \336>..., m_next_dup = 0x0, m_wks_idx = 64,
m_len_name = 10, m_len_value = 11, m_n_v_raw_printable = 1 '\001',
m_n_v_raw_printable_pad = 4 '\004',
m_readiness = 2 '\002', m_flags = 1 '\001'}, {
m_ptr_name = 0x7fffc408f052 "Accept: */*\r\nProxy-Connection:
Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ"...,
m_ptr_value = 0x7fffc408f05a "*/*\r\nProxy-Connection:
Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ"...,
m_next_dup = 0x0, m_wks_idx = 4,
m_len_name = 6, m_len_value = 3, m_n_v_raw_printable = 1 '\001',
m_n_v_raw_printable_pad = 4 '\004', m_readiness = 2 '\002',
m_flags = 1 '\001'}, {
m_ptr_name = 0x7fffc408f05f "Proxy-Connection:
Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276"...,
m_ptr_value = 0x7fffc408f071
"Keep-Alive\r\n\r\n\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357ޭ\276\357",
<incomplete sequence \336>..., m_next_dup = 0x0, m_wks_idx = 50, m_len_name =
16, m_len_value = 10, m_n_v_raw_printable = 1 '\001',
m_n_v_raw_printable_pad = 4 '\004', m_readiness = 2 '\002', m_flags = 1
'\001'}, {
m_ptr_name = 0xefbeaddeefbeadde <error: Cannot access memory at address
0xefbeaddeefbeadde>,
m_ptr_value = 0xefbeaddeefbeadde <error: Cannot access memory at
address 0xefbeaddeefbeadde>,
m_next_dup = 0xefbeaddeefbeadde, m_wks_idx = -21026, m_len_name =
61374, m_len_value = 12496350,
m_n_v_raw_printable = 1 '\001', m_n_v_raw_printable_pad = 7 '\a',
m_readiness = 2 '\002',
m_flags = 3 '\003'} <repeats 12 times>}}}
(gdb) p /x mh->m_slot_accelerators
$3 = {0xfffffff2, 0xffffffff, 0x3fffffff, 0xfff1ffff}
{code}
If the slot index accelerators where changed to be 8 bits, then only headers
stored in slots past 253 would need to be searched, which should be large
enough for quite some time. This would add only 16 bytes per alternate.
> Slot accelerator doesn't effect under certain condition
> -------------------------------------------------------
>
> Key: TS-4316
> URL: https://issues.apache.org/jira/browse/TS-4316
> Project: Traffic Server
> Issue Type: Bug
> Components: MIME
> Reporter: Masakazu Kitajo
> Assignee: Alan M. Carroll
> Fix For: sometime
>
>
> Slot accelerators seem to not effect if the stored slot number is 14 or 15.
> This is because {{mime_hdr_set_accelerators_and_presence_bits()}} regards
> slot number 14+ as "unknown" and stores MIME_FIELD_SLOTNUM_UNKNOWN(14) to an
> accelerator, and it causes slower search. Although there is no critical
> effect, it would decreases performance slightly.
> The numbers, 14 and 15, comes from constants below in MIME.h:
> {code}
> #define MIME_FIELD_SLOTNUM_BITS 4
> #define MIME_FIELD_SLOTNUM_MASK ((1 << MIME_FIELD_SLOTNUM_BITS) - 1)
> #define MIME_FIELD_SLOTNUM_MAX (MIME_FIELD_SLOTNUM_MASK - 1)
> #define MIME_FIELD_SLOTNUM_UNKNOWN MIME_FIELD_SLOTNUM_MAX
> {code}
> MIME_FIELD_SLOTNUM_MASK is 15.
> MIME_FIELD_SLOTNUM_MAX is 14.
> MIME_FIELD_SLOTNUM_UNKNOWN is 14 too.
> Though it still needs more careful confirmation, it seems we can simply
> change {{MIME_FIELD_SLOTNUM_UNKNOWN}} to the value of
> {{MIME_FIELD_SLOTNUM_MASK}} (15). But we still cannot use 15.
> To use 15 as a valid slot number in slot accelerators, we need to change
> {{MIME_FIELD_SLOTNUM_UNKNOWN}} to 16 or -1, however it would need to change
> some codes also (not only the number).
> This bug has been found while I was tackling TS-4313.
> https://github.com/apache/trafficserver/pull/542#discussion-diff-58226891
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)