You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by Fei Deng <du...@apache.org> on 2019/06/17 21:13:05 UTC

New API proposal: TSEmergencyShutdown

void TSEmergencyShutdown(const char *log_msg);

This API is a wrapper for the "Emergency" call, which signals
traffic_manager to not restart traffic_server after the shutdown, i.e. this
call should be used when something has gone wrong and cannot be recovered
by a restart.

Re: New API proposal: TSEmergencyShutdown

Posted by Leif Hedstrom <zw...@apache.org>.

> On Jun 17, 2019, at 3:13 PM, Fei Deng <du...@apache.org> wrote:
> 
> void TSEmergencyShutdown(const char *log_msg);
> 
> This API is a wrapper for the "Emergency" call, which signals
> traffic_manager to not restart traffic_server after the shutdown, i.e. this
> call should be used when something has gone wrong and cannot be recovered
> by a restart.


Hmmm, can’t you do this via the manager APIs? If not, shouldn’t we add it there? It feels this should go through the manager channel, particularly as we go deeper into making the manager API / port more useful.

If there is no such mgmt API, we probably should add it, such that we get this both into the mgmt API as well as traffic_ctl.

— Leif


Re: New API proposal: TSEmergencyShutdown

Posted by Kamil Abboud <ki...@gmail.com>.
unsubscribe

On Wed, Jun 19, 2019 at 7:13 PM Fei Deng <du...@gmail.com> wrote:

> Adding some notes here from the discussion we had just now:
>
>    - *Fatal* and *Emergency* both need to be exposed to plugins, where
>    *Emergency* keeps traffic server down and *Fatal* will try and restart
>    (just like the core functions).
>    - When reading configs for the first time and fails, traffic server
>    should call *Emergency*, while on a config reload it should not call it
>    and fall back to the previous configuration.
>
> If I forgot something we just talked about please add to this note @Alan
> @Bryan.
>
> Regards,
> Fei Deng
>
>
> On Tue, Jun 18, 2019 at 10:11 AM Fei Deng <du...@gmail.com> wrote:
>
> > So this is what it looks like now:
> >
> > tsapi void
> > TSEmergency(const char *fmt, ...)
> > {
> >   va_list args;
> >
> >   va_start(args, fmt);
> >   EmergencyV(fmt, args);
> >   va_end(args);
> > }
> >
> > Regards,
> > Fei Deng
> >
> >
> > On Tue, Jun 18, 2019 at 9:41 AM Fei Deng <du...@gmail.com> wrote:
> >
> >> Yes, this is suggested by Alan and Susan, since sometimes we need
> plugins
> >> to be able to abort and not try to restart (say if some important files
> are
> >> missing). I'll change the name to TSEmergency().
> >>
> >> And I'll look at TSDebug and TSError, and make it similar to those.
> >>
> >> Regards,
> >> Fei Deng
> >>
> >>
> >> On Mon, Jun 17, 2019 at 5:59 PM Bryan Call <bc...@apache.org> wrote:
> >>
> >>> Looking how Emergency() vs ink_emergency() works.  The only difference
> >>> is Emergency() calls Diags::cleanup_func() with is only defined in
> >>> traffic_manager.
> >>>
> >>> Here is the call stack for Emergency():
> >>> Emergency > DiagsError > diags->error > error_va > ink_emergency_va >
> >>> ::exit(UNRECOVERABLE_EXIT)
> >>>
> >>> Vs
> >>> ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)
> >>>
> >>> -Bryan
> >>>
> >>>
> >>> > On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
> >>> >
> >>> > I would assume he is going to be calling ink_emergency(), so it
> >>> wouldn’t be a management API.
> >>> >
> >>> > Fei, can you add more details about what "This API is a wrapper for
> >>> the "Emergency” call” is really going to do?
> >>> >
> >>> > -Bryan
> >>> >
> >>> >
> >>> >> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org>
> wrote:
> >>> >>
> >>> >>
> >>> >>
> >>> >>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
> >>> >>>
> >>> >>> I would recommend having it like TSDebug and TSError.
> >>> >>>
> >>> >>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> >>> >>>
> >>> >>> TSDebug and TSError:
> >>> >>> tsapi void TSDebug(const char *tag, const char *format_str, ...)
> >>> TS_PRINTFLIKE(2, 3);
> >>> >>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> >>> >>>
> >>> >>
> >>> >>
> >>> >> What I don’t like with the original idea is that we’re putting
> >>> management APIs (which we have ts/mgmt.h for) into the plugin APIs.
> There
> >>> should be nothing stopping a plugin from using the management APIs I
> don’t
> >>> think? If there is, that’s yet another issue.
> >>> >>
> >>> >> I feel reasonably strongly about not merging ts/hmgmt.h
> functionality
> >>> into ts/ts.h.
> >>> >>
> >>> >> — Leif
> >>> >>
> >>> >>>
> >>> >>> -Bryan
> >>> >>>
> >>> >>>
> >>> >>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org>
> wrote:
> >>> >>>>
> >>> >>>> void TSEmergencyShutdown(const char *log_msg);
> >>> >>>>
> >>> >>>> This API is a wrapper for the "Emergency" call, which signals
> >>> >>>> traffic_manager to not restart traffic_server after the shutdown,
> >>> i.e. this
> >>> >>>> call should be used when something has gone wrong and cannot be
> >>> recovered
> >>> >>>> by a restart.
> >>> >>>
> >>> >>
> >>> >
> >>>
> >>>
>


-- 
-------------------------------
Have a Nice Day,
Kamil Abboud

Re: New API proposal: TSEmergencyShutdown

Posted by Alan Carroll <so...@verizonmedia.com.INVALID>.
Weighing in late, as usual, but I'm not sure what Leif means by
"ts/mgmt.h". Did you mean "ts/mgmtapi.h"? If so, that's a rather heavy
weight solution for the desired action here. AFAICT using that requires
setting up a full API client, not just making a single call to send a
message. You'd also have the problem that it wouldn't work without
`traffic_manager` which could be problematic for testing.

The main goal here is to address a chronic issue which is the ability for
plugins to shutdown ATS in a standard way, certainly better than calling
"abort()" or "TSAssert(false)".

On Wed, Jun 19, 2019 at 3:04 PM Fei Deng <du...@gmail.com> wrote:

> I think it is already logging it right now, leif had a new PR for it just
> recently to remove the Emergency call.
>
> Regards,
> Fei Deng
>
>
> On Wed, Jun 19, 2019 at 11:18 AM Sudheer Vinukonda
> <su...@yahoo.com.invalid> wrote:
>
> >  >>> ....while on a config reload it should not call it and fall back to
> > the previous configuration.
> > Is there a way we can alert this (at a minimum, an Error log?)?
> > Falling back to old config (definitely preferable), but, silently is a
> bit
> > misleading and confusing.
> >
> > - Sudheer
> >
> >     On Wednesday, June 19, 2019, 9:13:44 AM PDT, Fei Deng <
> > duke8253@gmail.com> wrote:
> >
> >  Adding some notes here from the discussion we had just now:
> >
> >   - *Fatal* and *Emergency* both need to be exposed to plugins, where
> >   *Emergency* keeps traffic server down and *Fatal* will try and restart
> >   (just like the core functions).
> >   - When reading configs for the first time and fails, traffic server
> >   should call *Emergency*, while on a config reload it should not call it
> >   and fall back to the previous configuration.
> >
> > If I forgot something we just talked about please add to this note @Alan
> > @Bryan.
> >
> > Regards,
> > Fei Deng
> >
> >
> > On Tue, Jun 18, 2019 at 10:11 AM Fei Deng <du...@gmail.com> wrote:
> >
> > > So this is what it looks like now:
> > >
> > > tsapi void
> > > TSEmergency(const char *fmt, ...)
> > > {
> > >  va_list args;
> > >
> > >  va_start(args, fmt);
> > >  EmergencyV(fmt, args);
> > >  va_end(args);
> > > }
> > >
> > > Regards,
> > > Fei Deng
> > >
> > >
> > > On Tue, Jun 18, 2019 at 9:41 AM Fei Deng <du...@gmail.com> wrote:
> > >
> > >> Yes, this is suggested by Alan and Susan, since sometimes we need
> > plugins
> > >> to be able to abort and not try to restart (say if some important
> files
> > are
> > >> missing). I'll change the name to TSEmergency().
> > >>
> > >> And I'll look at TSDebug and TSError, and make it similar to those.
> > >>
> > >> Regards,
> > >> Fei Deng
> > >>
> > >>
> > >> On Mon, Jun 17, 2019 at 5:59 PM Bryan Call <bc...@apache.org> wrote:
> > >>
> > >>> Looking how Emergency() vs ink_emergency() works.  The only
> difference
> > >>> is Emergency() calls Diags::cleanup_func() with is only defined in
> > >>> traffic_manager.
> > >>>
> > >>> Here is the call stack for Emergency():
> > >>> Emergency > DiagsError > diags->error > error_va > ink_emergency_va >
> > >>> ::exit(UNRECOVERABLE_EXIT)
> > >>>
> > >>> Vs
> > >>> ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)
> > >>>
> > >>> -Bryan
> > >>>
> > >>>
> > >>> > On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
> > >>> >
> > >>> > I would assume he is going to be calling ink_emergency(), so it
> > >>> wouldn’t be a management API.
> > >>> >
> > >>> > Fei, can you add more details about what "This API is a wrapper for
> > >>> the "Emergency” call” is really going to do?
> > >>> >
> > >>> > -Bryan
> > >>> >
> > >>> >
> > >>> >> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org>
> > wrote:
> > >>> >>
> > >>> >>
> > >>> >>
> > >>> >>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org>
> wrote:
> > >>> >>>
> > >>> >>> I would recommend having it like TSDebug and TSError.
> > >>> >>>
> > >>> >>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> > >>> >>>
> > >>> >>> TSDebug and TSError:
> > >>> >>> tsapi void TSDebug(const char *tag, const char *format_str, ...)
> > >>> TS_PRINTFLIKE(2, 3);
> > >>> >>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> > >>> >>>
> > >>> >>
> > >>> >>
> > >>> >> What I don’t like with the original idea is that we’re putting
> > >>> management APIs (which we have ts/mgmt.h for) into the plugin APIs.
> > There
> > >>> should be nothing stopping a plugin from using the management APIs I
> > don’t
> > >>> think? If there is, that’s yet another issue.
> > >>> >>
> > >>> >> I feel reasonably strongly about not merging ts/hmgmt.h
> > functionality
> > >>> into ts/ts.h.
> > >>> >>
> > >>> >> — Leif
> > >>> >>
> > >>> >>>
> > >>> >>> -Bryan
> > >>> >>>
> > >>> >>>
> > >>> >>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org>
> > wrote:
> > >>> >>>>
> > >>> >>>> void TSEmergencyShutdown(const char *log_msg);
> > >>> >>>>
> > >>> >>>> This API is a wrapper for the "Emergency" call, which signals
> > >>> >>>> traffic_manager to not restart traffic_server after the
> shutdown,
> > >>> i.e. this
> > >>> >>>> call should be used when something has gone wrong and cannot be
> > >>> recovered
> > >>> >>>> by a restart.
> > >>> >>>
> > >>> >>
> > >>> >
> > >>>
> > >>>
>

Re: New API proposal: TSEmergencyShutdown

Posted by Fei Deng <du...@gmail.com>.
I think it is already logging it right now, leif had a new PR for it just
recently to remove the Emergency call.

Regards,
Fei Deng


On Wed, Jun 19, 2019 at 11:18 AM Sudheer Vinukonda
<su...@yahoo.com.invalid> wrote:

>  >>> ....while on a config reload it should not call it and fall back to
> the previous configuration.
> Is there a way we can alert this (at a minimum, an Error log?)?
> Falling back to old config (definitely preferable), but, silently is a bit
> misleading and confusing.
>
> - Sudheer
>
>     On Wednesday, June 19, 2019, 9:13:44 AM PDT, Fei Deng <
> duke8253@gmail.com> wrote:
>
>  Adding some notes here from the discussion we had just now:
>
>   - *Fatal* and *Emergency* both need to be exposed to plugins, where
>   *Emergency* keeps traffic server down and *Fatal* will try and restart
>   (just like the core functions).
>   - When reading configs for the first time and fails, traffic server
>   should call *Emergency*, while on a config reload it should not call it
>   and fall back to the previous configuration.
>
> If I forgot something we just talked about please add to this note @Alan
> @Bryan.
>
> Regards,
> Fei Deng
>
>
> On Tue, Jun 18, 2019 at 10:11 AM Fei Deng <du...@gmail.com> wrote:
>
> > So this is what it looks like now:
> >
> > tsapi void
> > TSEmergency(const char *fmt, ...)
> > {
> >  va_list args;
> >
> >  va_start(args, fmt);
> >  EmergencyV(fmt, args);
> >  va_end(args);
> > }
> >
> > Regards,
> > Fei Deng
> >
> >
> > On Tue, Jun 18, 2019 at 9:41 AM Fei Deng <du...@gmail.com> wrote:
> >
> >> Yes, this is suggested by Alan and Susan, since sometimes we need
> plugins
> >> to be able to abort and not try to restart (say if some important files
> are
> >> missing). I'll change the name to TSEmergency().
> >>
> >> And I'll look at TSDebug and TSError, and make it similar to those.
> >>
> >> Regards,
> >> Fei Deng
> >>
> >>
> >> On Mon, Jun 17, 2019 at 5:59 PM Bryan Call <bc...@apache.org> wrote:
> >>
> >>> Looking how Emergency() vs ink_emergency() works.  The only difference
> >>> is Emergency() calls Diags::cleanup_func() with is only defined in
> >>> traffic_manager.
> >>>
> >>> Here is the call stack for Emergency():
> >>> Emergency > DiagsError > diags->error > error_va > ink_emergency_va >
> >>> ::exit(UNRECOVERABLE_EXIT)
> >>>
> >>> Vs
> >>> ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)
> >>>
> >>> -Bryan
> >>>
> >>>
> >>> > On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
> >>> >
> >>> > I would assume he is going to be calling ink_emergency(), so it
> >>> wouldn’t be a management API.
> >>> >
> >>> > Fei, can you add more details about what "This API is a wrapper for
> >>> the "Emergency” call” is really going to do?
> >>> >
> >>> > -Bryan
> >>> >
> >>> >
> >>> >> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org>
> wrote:
> >>> >>
> >>> >>
> >>> >>
> >>> >>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
> >>> >>>
> >>> >>> I would recommend having it like TSDebug and TSError.
> >>> >>>
> >>> >>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> >>> >>>
> >>> >>> TSDebug and TSError:
> >>> >>> tsapi void TSDebug(const char *tag, const char *format_str, ...)
> >>> TS_PRINTFLIKE(2, 3);
> >>> >>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> >>> >>>
> >>> >>
> >>> >>
> >>> >> What I don’t like with the original idea is that we’re putting
> >>> management APIs (which we have ts/mgmt.h for) into the plugin APIs.
> There
> >>> should be nothing stopping a plugin from using the management APIs I
> don’t
> >>> think? If there is, that’s yet another issue.
> >>> >>
> >>> >> I feel reasonably strongly about not merging ts/hmgmt.h
> functionality
> >>> into ts/ts.h.
> >>> >>
> >>> >> — Leif
> >>> >>
> >>> >>>
> >>> >>> -Bryan
> >>> >>>
> >>> >>>
> >>> >>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org>
> wrote:
> >>> >>>>
> >>> >>>> void TSEmergencyShutdown(const char *log_msg);
> >>> >>>>
> >>> >>>> This API is a wrapper for the "Emergency" call, which signals
> >>> >>>> traffic_manager to not restart traffic_server after the shutdown,
> >>> i.e. this
> >>> >>>> call should be used when something has gone wrong and cannot be
> >>> recovered
> >>> >>>> by a restart.
> >>> >>>
> >>> >>
> >>> >
> >>>
> >>>

Re: New API proposal: TSEmergencyShutdown

Posted by Sudheer Vinukonda <su...@yahoo.com.INVALID>.
 >>> ....while on a config reload it should not call it and fall back to the previous configuration.
Is there a way we can alert this (at a minimum, an Error log?)? 
Falling back to old config (definitely preferable), but, silently is a bit misleading and confusing.

- Sudheer

    On Wednesday, June 19, 2019, 9:13:44 AM PDT, Fei Deng <du...@gmail.com> wrote:  
 
 Adding some notes here from the discussion we had just now:

  - *Fatal* and *Emergency* both need to be exposed to plugins, where
  *Emergency* keeps traffic server down and *Fatal* will try and restart
  (just like the core functions).
  - When reading configs for the first time and fails, traffic server
  should call *Emergency*, while on a config reload it should not call it
  and fall back to the previous configuration.

If I forgot something we just talked about please add to this note @Alan
@Bryan.

Regards,
Fei Deng


On Tue, Jun 18, 2019 at 10:11 AM Fei Deng <du...@gmail.com> wrote:

> So this is what it looks like now:
>
> tsapi void
> TSEmergency(const char *fmt, ...)
> {
>  va_list args;
>
>  va_start(args, fmt);
>  EmergencyV(fmt, args);
>  va_end(args);
> }
>
> Regards,
> Fei Deng
>
>
> On Tue, Jun 18, 2019 at 9:41 AM Fei Deng <du...@gmail.com> wrote:
>
>> Yes, this is suggested by Alan and Susan, since sometimes we need plugins
>> to be able to abort and not try to restart (say if some important files are
>> missing). I'll change the name to TSEmergency().
>>
>> And I'll look at TSDebug and TSError, and make it similar to those.
>>
>> Regards,
>> Fei Deng
>>
>>
>> On Mon, Jun 17, 2019 at 5:59 PM Bryan Call <bc...@apache.org> wrote:
>>
>>> Looking how Emergency() vs ink_emergency() works.  The only difference
>>> is Emergency() calls Diags::cleanup_func() with is only defined in
>>> traffic_manager.
>>>
>>> Here is the call stack for Emergency():
>>> Emergency > DiagsError > diags->error > error_va > ink_emergency_va >
>>> ::exit(UNRECOVERABLE_EXIT)
>>>
>>> Vs
>>> ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)
>>>
>>> -Bryan
>>>
>>>
>>> > On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
>>> >
>>> > I would assume he is going to be calling ink_emergency(), so it
>>> wouldn’t be a management API.
>>> >
>>> > Fei, can you add more details about what "This API is a wrapper for
>>> the "Emergency” call” is really going to do?
>>> >
>>> > -Bryan
>>> >
>>> >
>>> >> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org> wrote:
>>> >>
>>> >>
>>> >>
>>> >>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
>>> >>>
>>> >>> I would recommend having it like TSDebug and TSError.
>>> >>>
>>> >>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> >>>
>>> >>> TSDebug and TSError:
>>> >>> tsapi void TSDebug(const char *tag, const char *format_str, ...)
>>> TS_PRINTFLIKE(2, 3);
>>> >>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> >>>
>>> >>
>>> >>
>>> >> What I don’t like with the original idea is that we’re putting
>>> management APIs (which we have ts/mgmt.h for) into the plugin APIs. There
>>> should be nothing stopping a plugin from using the management APIs I don’t
>>> think? If there is, that’s yet another issue.
>>> >>
>>> >> I feel reasonably strongly about not merging ts/hmgmt.h functionality
>>> into ts/ts.h.
>>> >>
>>> >> — Leif
>>> >>
>>> >>>
>>> >>> -Bryan
>>> >>>
>>> >>>
>>> >>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
>>> >>>>
>>> >>>> void TSEmergencyShutdown(const char *log_msg);
>>> >>>>
>>> >>>> This API is a wrapper for the "Emergency" call, which signals
>>> >>>> traffic_manager to not restart traffic_server after the shutdown,
>>> i.e. this
>>> >>>> call should be used when something has gone wrong and cannot be
>>> recovered
>>> >>>> by a restart.
>>> >>>
>>> >>
>>> >
>>>
>>>  

Re: New API proposal: TSEmergencyShutdown

Posted by Fei Deng <du...@gmail.com>.
Adding some notes here from the discussion we had just now:

   - *Fatal* and *Emergency* both need to be exposed to plugins, where
   *Emergency* keeps traffic server down and *Fatal* will try and restart
   (just like the core functions).
   - When reading configs for the first time and fails, traffic server
   should call *Emergency*, while on a config reload it should not call it
   and fall back to the previous configuration.

If I forgot something we just talked about please add to this note @Alan
@Bryan.

Regards,
Fei Deng


On Tue, Jun 18, 2019 at 10:11 AM Fei Deng <du...@gmail.com> wrote:

> So this is what it looks like now:
>
> tsapi void
> TSEmergency(const char *fmt, ...)
> {
>   va_list args;
>
>   va_start(args, fmt);
>   EmergencyV(fmt, args);
>   va_end(args);
> }
>
> Regards,
> Fei Deng
>
>
> On Tue, Jun 18, 2019 at 9:41 AM Fei Deng <du...@gmail.com> wrote:
>
>> Yes, this is suggested by Alan and Susan, since sometimes we need plugins
>> to be able to abort and not try to restart (say if some important files are
>> missing). I'll change the name to TSEmergency().
>>
>> And I'll look at TSDebug and TSError, and make it similar to those.
>>
>> Regards,
>> Fei Deng
>>
>>
>> On Mon, Jun 17, 2019 at 5:59 PM Bryan Call <bc...@apache.org> wrote:
>>
>>> Looking how Emergency() vs ink_emergency() works.  The only difference
>>> is Emergency() calls Diags::cleanup_func() with is only defined in
>>> traffic_manager.
>>>
>>> Here is the call stack for Emergency():
>>> Emergency > DiagsError > diags->error > error_va > ink_emergency_va >
>>> ::exit(UNRECOVERABLE_EXIT)
>>>
>>> Vs
>>> ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)
>>>
>>> -Bryan
>>>
>>>
>>> > On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
>>> >
>>> > I would assume he is going to be calling ink_emergency(), so it
>>> wouldn’t be a management API.
>>> >
>>> > Fei, can you add more details about what "This API is a wrapper for
>>> the "Emergency” call” is really going to do?
>>> >
>>> > -Bryan
>>> >
>>> >
>>> >> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org> wrote:
>>> >>
>>> >>
>>> >>
>>> >>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
>>> >>>
>>> >>> I would recommend having it like TSDebug and TSError.
>>> >>>
>>> >>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> >>>
>>> >>> TSDebug and TSError:
>>> >>> tsapi void TSDebug(const char *tag, const char *format_str, ...)
>>> TS_PRINTFLIKE(2, 3);
>>> >>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> >>>
>>> >>
>>> >>
>>> >> What I don’t like with the original idea is that we’re putting
>>> management APIs (which we have ts/mgmt.h for) into the plugin APIs. There
>>> should be nothing stopping a plugin from using the management APIs I don’t
>>> think? If there is, that’s yet another issue.
>>> >>
>>> >> I feel reasonably strongly about not merging ts/hmgmt.h functionality
>>> into ts/ts.h.
>>> >>
>>> >> — Leif
>>> >>
>>> >>>
>>> >>> -Bryan
>>> >>>
>>> >>>
>>> >>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
>>> >>>>
>>> >>>> void TSEmergencyShutdown(const char *log_msg);
>>> >>>>
>>> >>>> This API is a wrapper for the "Emergency" call, which signals
>>> >>>> traffic_manager to not restart traffic_server after the shutdown,
>>> i.e. this
>>> >>>> call should be used when something has gone wrong and cannot be
>>> recovered
>>> >>>> by a restart.
>>> >>>
>>> >>
>>> >
>>>
>>>

Re: New API proposal: TSEmergencyShutdown

Posted by Fei Deng <du...@gmail.com>.
So this is what it looks like now:

tsapi void
TSEmergency(const char *fmt, ...)
{
  va_list args;

  va_start(args, fmt);
  EmergencyV(fmt, args);
  va_end(args);
}

Regards,
Fei Deng


On Tue, Jun 18, 2019 at 9:41 AM Fei Deng <du...@gmail.com> wrote:

> Yes, this is suggested by Alan and Susan, since sometimes we need plugins
> to be able to abort and not try to restart (say if some important files are
> missing). I'll change the name to TSEmergency().
>
> And I'll look at TSDebug and TSError, and make it similar to those.
>
> Regards,
> Fei Deng
>
>
> On Mon, Jun 17, 2019 at 5:59 PM Bryan Call <bc...@apache.org> wrote:
>
>> Looking how Emergency() vs ink_emergency() works.  The only difference is
>> Emergency() calls Diags::cleanup_func() with is only defined in
>> traffic_manager.
>>
>> Here is the call stack for Emergency():
>> Emergency > DiagsError > diags->error > error_va > ink_emergency_va >
>> ::exit(UNRECOVERABLE_EXIT)
>>
>> Vs
>> ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)
>>
>> -Bryan
>>
>>
>> > On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
>> >
>> > I would assume he is going to be calling ink_emergency(), so it
>> wouldn’t be a management API.
>> >
>> > Fei, can you add more details about what "This API is a wrapper for the
>> "Emergency” call” is really going to do?
>> >
>> > -Bryan
>> >
>> >
>> >> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org> wrote:
>> >>
>> >>
>> >>
>> >>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
>> >>>
>> >>> I would recommend having it like TSDebug and TSError.
>> >>>
>> >>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>> >>>
>> >>> TSDebug and TSError:
>> >>> tsapi void TSDebug(const char *tag, const char *format_str, ...)
>> TS_PRINTFLIKE(2, 3);
>> >>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>> >>>
>> >>
>> >>
>> >> What I don’t like with the original idea is that we’re putting
>> management APIs (which we have ts/mgmt.h for) into the plugin APIs. There
>> should be nothing stopping a plugin from using the management APIs I don’t
>> think? If there is, that’s yet another issue.
>> >>
>> >> I feel reasonably strongly about not merging ts/hmgmt.h functionality
>> into ts/ts.h.
>> >>
>> >> — Leif
>> >>
>> >>>
>> >>> -Bryan
>> >>>
>> >>>
>> >>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
>> >>>>
>> >>>> void TSEmergencyShutdown(const char *log_msg);
>> >>>>
>> >>>> This API is a wrapper for the "Emergency" call, which signals
>> >>>> traffic_manager to not restart traffic_server after the shutdown,
>> i.e. this
>> >>>> call should be used when something has gone wrong and cannot be
>> recovered
>> >>>> by a restart.
>> >>>
>> >>
>> >
>>
>>

Re: New API proposal: TSEmergencyShutdown

Posted by Fei Deng <du...@gmail.com>.
Yes, this is suggested by Alan and Susan, since sometimes we need plugins
to be able to abort and not try to restart (say if some important files are
missing). I'll change the name to TSEmergency().

And I'll look at TSDebug and TSError, and make it similar to those.

Regards,
Fei Deng


On Mon, Jun 17, 2019 at 5:59 PM Bryan Call <bc...@apache.org> wrote:

> Looking how Emergency() vs ink_emergency() works.  The only difference is
> Emergency() calls Diags::cleanup_func() with is only defined in
> traffic_manager.
>
> Here is the call stack for Emergency():
> Emergency > DiagsError > diags->error > error_va > ink_emergency_va >
> ::exit(UNRECOVERABLE_EXIT)
>
> Vs
> ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)
>
> -Bryan
>
>
> > On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
> >
> > I would assume he is going to be calling ink_emergency(), so it wouldn’t
> be a management API.
> >
> > Fei, can you add more details about what "This API is a wrapper for the
> "Emergency” call” is really going to do?
> >
> > -Bryan
> >
> >
> >> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org> wrote:
> >>
> >>
> >>
> >>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
> >>>
> >>> I would recommend having it like TSDebug and TSError.
> >>>
> >>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> >>>
> >>> TSDebug and TSError:
> >>> tsapi void TSDebug(const char *tag, const char *format_str, ...)
> TS_PRINTFLIKE(2, 3);
> >>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> >>>
> >>
> >>
> >> What I don’t like with the original idea is that we’re putting
> management APIs (which we have ts/mgmt.h for) into the plugin APIs. There
> should be nothing stopping a plugin from using the management APIs I don’t
> think? If there is, that’s yet another issue.
> >>
> >> I feel reasonably strongly about not merging ts/hmgmt.h functionality
> into ts/ts.h.
> >>
> >> — Leif
> >>
> >>>
> >>> -Bryan
> >>>
> >>>
> >>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
> >>>>
> >>>> void TSEmergencyShutdown(const char *log_msg);
> >>>>
> >>>> This API is a wrapper for the "Emergency" call, which signals
> >>>> traffic_manager to not restart traffic_server after the shutdown,
> i.e. this
> >>>> call should be used when something has gone wrong and cannot be
> recovered
> >>>> by a restart.
> >>>
> >>
> >
>
>

Re: New API proposal: TSEmergencyShutdown

Posted by Bryan Call <bc...@apache.org>.
Looking how Emergency() vs ink_emergency() works.  The only difference is Emergency() calls Diags::cleanup_func() with is only defined in traffic_manager.

Here is the call stack for Emergency():
Emergency > DiagsError > diags->error > error_va > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)

Vs
ink_emergency > ink_emergency_va > ::exit(UNRECOVERABLE_EXIT)

-Bryan


> On Jun 17, 2019, at 3:27 PM, Bryan Call <bc...@apache.org> wrote:
> 
> I would assume he is going to be calling ink_emergency(), so it wouldn’t be a management API.
> 
> Fei, can you add more details about what "This API is a wrapper for the "Emergency” call” is really going to do?
> 
> -Bryan
> 
> 
>> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org> wrote:
>> 
>> 
>> 
>>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
>>> 
>>> I would recommend having it like TSDebug and TSError.
>>> 
>>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> 
>>> TSDebug and TSError:
>>> tsapi void TSDebug(const char *tag, const char *format_str, ...) TS_PRINTFLIKE(2, 3);
>>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> 
>> 
>> 
>> What I don’t like with the original idea is that we’re putting management APIs (which we have ts/mgmt.h for) into the plugin APIs. There should be nothing stopping a plugin from using the management APIs I don’t think? If there is, that’s yet another issue. 
>> 
>> I feel reasonably strongly about not merging ts/hmgmt.h functionality into ts/ts.h.
>> 
>> — Leif
>> 
>>> 
>>> -Bryan
>>> 
>>> 
>>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
>>>> 
>>>> void TSEmergencyShutdown(const char *log_msg);
>>>> 
>>>> This API is a wrapper for the "Emergency" call, which signals
>>>> traffic_manager to not restart traffic_server after the shutdown, i.e. this
>>>> call should be used when something has gone wrong and cannot be recovered
>>>> by a restart.
>>> 
>> 
> 


Re: New API proposal: TSEmergencyShutdown

Posted by Leif Hedstrom <zw...@apache.org>.

> On Jun 17, 2019, at 4:27 PM, Bryan Call <bc...@apache.org> wrote:
> 
> I would assume he is going to be calling ink_emergency(), so it wouldn’t be a management API.

That’s not what I meant :).

I believe things that does process management, such as stop / start / check status etc. etc. all belongs in the mgmt APIs. Meaning, you signal traffic_manager what your intent is, and it does the appropriate marshaling and scheduling of events. Then the local manager handler for this event calls “ink_emergency()” inside of traffic_server, on behalf of the management API.

I understand your point though, this would be something a plugin would do as an extreme Error() call.  If this is what we want, then I agree with bcall in that it should be like TSError(), e.g. TSEmergency().

While looking at this, I noticed that we call Emergency when parsing records.config, that’s a really bad idea :-/. Commit #7f08ad6044, I will file an Issue, we should remove that.

Cheers,

— Leif

> 
> Fei, can you add more details about what "This API is a wrapper for the "Emergency” call” is really going to do?
> 
> -Bryan
> 
> 
>> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org> wrote:
>> 
>> 
>> 
>>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
>>> 
>>> I would recommend having it like TSDebug and TSError.
>>> 
>>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> 
>>> TSDebug and TSError:
>>> tsapi void TSDebug(const char *tag, const char *format_str, ...) TS_PRINTFLIKE(2, 3);
>>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>>> 
>> 
>> 
>> What I don’t like with the original idea is that we’re putting management APIs (which we have ts/mgmt.h for) into the plugin APIs. There should be nothing stopping a plugin from using the management APIs I don’t think? If there is, that’s yet another issue. 
>> 
>> I feel reasonably strongly about not merging ts/hmgmt.h functionality into ts/ts.h.
>> 
>> — Leif
>> 
>>> 
>>> -Bryan
>>> 
>>> 
>>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
>>>> 
>>>> void TSEmergencyShutdown(const char *log_msg);
>>>> 
>>>> This API is a wrapper for the "Emergency" call, which signals
>>>> traffic_manager to not restart traffic_server after the shutdown, i.e. this
>>>> call should be used when something has gone wrong and cannot be recovered
>>>> by a restart.
>>> 
>> 
> 


Re: New API proposal: TSEmergencyShutdown

Posted by Bryan Call <bc...@apache.org>.
I would assume he is going to be calling ink_emergency(), so it wouldn’t be a management API.

Fei, can you add more details about what "This API is a wrapper for the "Emergency” call” is really going to do?

-Bryan


> On Jun 17, 2019, at 3:22 PM, Leif Hedstrom <zw...@apache.org> wrote:
> 
> 
> 
>> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
>> 
>> I would recommend having it like TSDebug and TSError.
>> 
>> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>> 
>> TSDebug and TSError:
>> tsapi void TSDebug(const char *tag, const char *format_str, ...) TS_PRINTFLIKE(2, 3);
>> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
>> 
> 
> 
> What I don’t like with the original idea is that we’re putting management APIs (which we have ts/mgmt.h for) into the plugin APIs. There should be nothing stopping a plugin from using the management APIs I don’t think? If there is, that’s yet another issue. 
> 
> I feel reasonably strongly about not merging ts/hmgmt.h functionality into ts/ts.h.
> 
> — Leif
> 
>> 
>> -Bryan
>> 
>> 
>>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
>>> 
>>> void TSEmergencyShutdown(const char *log_msg);
>>> 
>>> This API is a wrapper for the "Emergency" call, which signals
>>> traffic_manager to not restart traffic_server after the shutdown, i.e. this
>>> call should be used when something has gone wrong and cannot be recovered
>>> by a restart.
>> 
> 


Re: New API proposal: TSEmergencyShutdown

Posted by Leif Hedstrom <zw...@apache.org>.

> On Jun 17, 2019, at 4:16 PM, Bryan Call <bc...@apache.org> wrote:
> 
> I would recommend having it like TSDebug and TSError.
> 
> tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> 
> TSDebug and TSError:
> tsapi void TSDebug(const char *tag, const char *format_str, ...) TS_PRINTFLIKE(2, 3);
> tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);
> 


What I don’t like with the original idea is that we’re putting management APIs (which we have ts/mgmt.h for) into the plugin APIs. There should be nothing stopping a plugin from using the management APIs I don’t think? If there is, that’s yet another issue. 

I feel reasonably strongly about not merging ts/hmgmt.h functionality into ts/ts.h.

— Leif

> 
> -Bryan
> 
> 
>> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
>> 
>> void TSEmergencyShutdown(const char *log_msg);
>> 
>> This API is a wrapper for the "Emergency" call, which signals
>> traffic_manager to not restart traffic_server after the shutdown, i.e. this
>> call should be used when something has gone wrong and cannot be recovered
>> by a restart.
> 


Re: New API proposal: TSEmergencyShutdown

Posted by Bryan Call <bc...@apache.org>.
I would recommend having it like TSDebug and TSError.

tsapi void TSEmergency(const char *fmt, ...) TS_PRINTFLIKE(1, 2);

TSDebug and TSError:
tsapi void TSDebug(const char *tag, const char *format_str, ...) TS_PRINTFLIKE(2, 3);
tsapi void TSError(const char *fmt, ...) TS_PRINTFLIKE(1, 2);


-Bryan


> On Jun 17, 2019, at 2:13 PM, Fei Deng <du...@apache.org> wrote:
> 
> void TSEmergencyShutdown(const char *log_msg);
> 
> This API is a wrapper for the "Emergency" call, which signals
> traffic_manager to not restart traffic_server after the shutdown, i.e. this
> call should be used when something has gone wrong and cannot be recovered
> by a restart.