You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@trafficserver.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2016/09/13 17:10:20 UTC

[jira] [Work logged] (TS-4840) Crash when reattaching to C++ API Stats.

     [ https://issues.apache.org/jira/browse/TS-4840?focusedWorklogId=28957&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-28957 ]

ASF GitHub Bot logged work on TS-4840:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 13/Sep/16 17:10
            Start Date: 13/Sep/16 17:10
    Worklog Time Spent: 10m 
      Work Description: GitHub user jpeach opened a pull request:

    https://github.com/apache/trafficserver/pull/1012

    TS-4840 Crash when reattaching to C++ API Stats.

    The change in TS-4793 regressed the C++ API Stat object. What happens is that if you restart traffic_server without traffic_manager, the TSStatFindName call finds the metric in the records hash table, but traffic_server has not set up the RSB entry so actually incrementing it crashes.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/jpeach/trafficserver fix/4840

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/1012.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1012
    
----
commit 77180a3a5771dc1d30820692ddd90862671dafb5
Author: James Peach <jp...@apache.org>
Date:   2016-09-13T16:39:20Z

    TS-4840: Ensure unallocated stats cannot be reattached.
    
    If traffic_server is restarted, any plugin stats that have been
    created are still registered in traffic_manager so we can find them
    on startup with TSStatFindName. However, because traffic_server is
    a new process, we don't have them allocated in the plugin RSB so
    things go awry from there.
    
    The solution is to not allow TSStatFindName to succeed unless there
    is a also plugin TSB entry allocated for this stat.

commit ea572e619dbd0fbd034154b94e32269a875a81d2
Author: James Peach <jp...@apache.org>
Date:   2016-09-13T16:42:50Z

    TS-4840: Clean up RecRawStats formatting.

commit 917731b8f0950028715c0e790a48edecae7993fe
Author: James Peach <jp...@apache.org>
Date:   2016-09-13T17:07:20Z

    TS-4840: Add statistic test plugin.
    
    Add an example plugin to demonstrate the statistics API and update
    the developer docs accordingly.

----


Issue Time Tracking
-------------------

            Worklog Id:     (was: 28957)
            Time Spent: 10m
    Remaining Estimate: 0h

> Crash when reattaching to C++ API Stats.
> ----------------------------------------
>
>                 Key: TS-4840
>                 URL: https://issues.apache.org/jira/browse/TS-4840
>             Project: Traffic Server
>          Issue Type: Bug
>          Components: CPP API, Metrics
>    Affects Versions: 7.0.0
>            Reporter: James Peach
>            Assignee: James Peach
>            Priority: Blocker
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> {noformat}
> Program received signal SIGSEGV, Segmentation fault.
> 0x00000000007f733c in ink_atomic_swap<long> (mem=0x0, value=1) at ../../lib/ts/ink_atomic.h:76
> 76	  return __sync_lock_test_and_set(mem, value);
> (gdb) where
> #0  0x00000000007f733c in ink_atomic_swap<long> (mem=0x0, value=1) at ../../lib/ts/ink_atomic.h:76
> #1  0x00000000007f6e56 in RecSetGlobalRawStatSum (rsb=0x2f16290, id=6, data=1) at RecRawStats.cc:482
> #2  0x00000000005372c9 in TSStatIntSet (the_stat=6, value=1) at InkAPI.cc:6944
> #3  0x00002ae6d3398bb1 in atscppapi::Stat::set (this=0x2ae6d37c2890 <...>, value=1) at Stat.cc:78
> #4  0x00002ae6d35bb826 in TSPluginInit (argc=1, argv=0x7ffd0613bfe0) at /home/jpeach/n/....cc:753
> #5  0x00000000005550e5 in plugin_load (argc=1, argv=0x7ffd0613bfe0, validateOnly=false) at Plugin.cc:137
> {noformat}
> The change in TS-4793 regressed the C++ API Stat object. What happens is that if you restart {{traffic_server}} without {{traffic_manager}}, the {{TSStatFindName}} call finds the metric in the records hash table, but {{traffic_server}} has not set up the RSB entry so actually incrementing it crashes.
> If you call {{TSStatCreate}} twice for the same metric, you will end up with multiple RSB slots being consumed which is almost as bad.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)