<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Definitely +1 for prompting in logs what is being happening and
      why shutdown takes longer period of time.</p>
    <p>Also the graceful shutdown adds timeout which can be used to
      limit maximum number of seconds for finishing shutdown gracefully,
      after that time it should stop waiting for remaining
      transactions/requests to finish.</p>
    <p>Note current default behaviour is to stop the server without
      using the graceful shutdown (timeout needs to be specified for
      actually using the graceful shutdown logic), for details see
      description of shutdown command timeout value.<br>
    </p>
    <p>Cheers.</p>
    <p>Radim<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 12/07/2016 02:49 PM, Jim Tyrrell
      wrote:<br>
    </div>
    <blockquote
      cite="mid:2EFD81C4-EA31-4E65-B50F-0FB30FF3F086@redhat.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Team,
      <div class=""><br class="">
      </div>
      <div class="">How might we process the shutting down with a
        transaction log message/s saying it is shutting down or saying
        something like:
        <div class=""><br class="">
        </div>
        <div class="">Started shutting down</div>
        <div class="">100 pending transactions</div>
        <div class="">10 shut down 90 pending</div>
        <div class="">20 shut down 80 pending</div>
        <div class=""><br class="">
        </div>
        <div class="">or something like that.</div>
        <div class=""><br class="">
        </div>
        <div class="">Feedback to the user in this sounds important to
          ensure people don’t kill -9 the process.</div>
        <div class="">
          <div class="">
            <div class=""><br class="">
              <div class="">
                <div class="">
                  <div style="orphans: 2; widows: 2;" class="">
                    <div class="">Jim Tyrrell</div>
                    <div class="">Principal JBoss Solutions Architect</div>
                  </div>
                  <div style="orphans: 2; widows: 2;" class="">Public
                    Sector Middleware Advocate</div>
                  <div style="orphans: 2; widows: 2;" class="">720-839-2251
                    mobile</div>
                </div>
              </div>
              <br class="">
              <div>
                <blockquote type="cite" class="">
                  <div class="">On Dec 6, 2016, at 8:50 AM, Andrig
                    Miller &lt;<a moz-do-not-send="true"
                      href="mailto:anmiller@redhat.com" class="">anmiller@redhat.com</a>&gt;
                    wrote:</div>
                  <br class="Apple-interchange-newline">
                  <div class="">
                    <div dir="ltr" style="font-family: Helvetica;
                      font-size: 12px; font-style: normal;
                      font-variant-caps: normal; font-weight: normal;
                      letter-spacing: normal; orphans: auto; text-align:
                      start; text-indent: 0px; text-transform: none;
                      white-space: normal; widows: auto; word-spacing:
                      0px; -webkit-text-stroke-width: 0px;" class="">
                      <div class="gmail_extra"><br
                          class="Apple-interchange-newline">
                        <br class="">
                        <div class="gmail_quote">On Mon, Dec 5, 2016 at
                          9:54 PM, Stuart Douglas<span
                            class="Apple-converted-space"> </span><span
                            dir="ltr" class="">&lt;<a
                              moz-do-not-send="true"
                              href="mailto:stuart.w.douglas@gmail.com"
                              target="_blank" class="">stuart.w.douglas@gmail.com</a>&gt;</span><span
                            class="Apple-converted-space"> </span>wrote:<br
                            class="">
                          <blockquote class="gmail_quote" style="margin:
                            0px 0px 0px 0.8ex; border-left-width: 1px;
                            border-left-color: rgb(204, 204, 204);
                            border-left-style: solid; padding-left:
                            1ex;">
                            <div dir="ltr" class=""><br class="">
                              <div class="gmail_extra"><br class="">
                                <div class="gmail_quote"><span class="">On
                                    Tue, Dec 6, 2016 at 10:12 AM, Andrig
                                    Miller<span
                                      class="Apple-converted-space"> </span><span
                                      dir="ltr" class="">&lt;<a
                                        moz-do-not-send="true"
                                        href="mailto:anmiller@redhat.com"
                                        target="_blank" class="">anmiller@redhat.com</a>&gt;</span><span
                                      class="Apple-converted-space"> </span>wrote:<br
                                      class="">
                                    <blockquote class="gmail_quote"
                                      style="margin: 0px 0px 0px 0.8ex;
                                      border-left-width: 1px;
                                      border-left-color: rgb(204, 204,
                                      204); border-left-style: solid;
                                      padding-left: 1ex;">
                                      <div dir="ltr" class="">
                                        <div style="font-size: large;"
                                          class="">I'm just wondering if
                                          we are making this graceful
                                          shutdown more complicated than
                                          necessary.<br class="">
                                          <br class="">
                                        </div>
                                        <div style="font-size: large;"
                                          class="">Why wouldn't we just
                                          cancel and force a rollback on
                                          any active transactions when
                                          shutting down?  Having
                                          experienced what a graceful
                                          shutdown can look like with a
                                          different architecture (BEA
                                          Tuxedo), I can tell you that
                                          it can take a very long time
                                          for the server to get to the
                                          point of shutting down, and
                                          appear to be hung by the
                                          administrator, depending on
                                          what was going on at the time
                                          the command was entered.<br
                                            class="">
                                        </div>
                                      </div>
                                    </blockquote>
                                    <div class=""><br class="">
                                      <br class="">
                                    </div>
                                  </span>
                                  <div class="">I think at the very
                                    least this has to be optional, so we
                                    can still have the old non
                                    transnational behavior (i.e. wait
                                    for requests to finish rather than
                                    transactions).<span
                                      class="Apple-converted-space"> </span><br
                                      class="">
                                  </div>
                                </div>
                              </div>
                            </div>
                          </blockquote>
                          <div class=""><br class="">
                            <div class="gmail_default" style="font-size:
                              large; display: inline;">​My personal
                              opinion is that it should be the default
                              behavior as well.  Most of the time, when
                              our administrators would try to gracefully
                              shutdown Tuxedo, then ended up killing it
                              with a kill -9, because it took too long. 
                              Of course, that caused all kinds of
                              consistency problems and transaction
                              recovery on the next startup.  Generally,
                              it was a mess.<br class="">
                              <br class="">
                            </div>
                            <div class="gmail_default" style="font-size:
                              large; display: inline;">Andy<br class="">
                              ​</div>
                             </div>
                          <blockquote class="gmail_quote" style="margin:
                            0px 0px 0px 0.8ex; border-left-width: 1px;
                            border-left-color: rgb(204, 204, 204);
                            border-left-style: solid; padding-left:
                            1ex;">
                            <div dir="ltr" class="">
                              <div class="gmail_extra">
                                <div class="gmail_quote">
                                  <div class=""><span class="HOEnZb"><font
                                        class="" color="#888888"><br
                                          class="">
                                      </font></span></div>
                                  <span class="HOEnZb"><font class=""
                                      color="#888888">
                                      <div class="">Stuart<br class="">
                                      </div>
                                    </font></span>
                                  <div class="">
                                    <div class="h5">
                                      <div class=""> </div>
                                      <blockquote class="gmail_quote"
                                        style="margin: 0px 0px 0px
                                        0.8ex; border-left-width: 1px;
                                        border-left-color: rgb(204, 204,
                                        204); border-left-style: solid;
                                        padding-left: 1ex;">
                                        <div dir="ltr" class="">
                                          <div style="font-size: large;"
                                            class=""><br class="">
                                          </div>
                                          <div style="font-size: large;"
                                            class="">We used to get
                                            administrators killing
                                            Tuxedo while it was
                                            "gracefully" shutting down,
                                            and messing lots of stuff
                                            up.<br class="">
                                            <br class="">
                                          </div>
                                          <div style="font-size: large;"
                                            class="">Andy<br class="">
                                          </div>
                                        </div>
                                        <div class="gmail_extra"><br
                                            class="">
                                          <div class="gmail_quote">
                                            <div class="">
                                              <div
                                                class="m_4632944962706681205h5">On
                                                Mon, Dec 5, 2016 at
                                                12:34 PM, Flavia Rainone<span
class="Apple-converted-space"> </span><span dir="ltr" class="">&lt;<a
                                                    moz-do-not-send="true"
href="mailto:frainone@redhat.com" target="_blank" class="">frainone@redhat.com</a>&gt;</span><span
class="Apple-converted-space"> </span>wrote:<br class="">
                                              </div>
                                            </div>
                                            <blockquote
                                              class="gmail_quote"
                                              style="margin: 0px 0px 0px
                                              0.8ex; border-left-width:
                                              1px; border-left-color:
                                              rgb(204, 204, 204);
                                              border-left-style: solid;
                                              padding-left: 1ex;">
                                              <div class="">
                                                <div
                                                  class="m_4632944962706681205h5">
                                                  <div bgcolor="#FFFFFF"
                                                    text="#000000"
                                                    class="">I think we
                                                    can keep open
                                                    transaction tracking
                                                    only inside
                                                    transactions
                                                    subsystem while we
                                                    are not shutting
                                                    down, and then we
                                                    can enroll for
                                                    notification of open
                                                    active transactions
                                                    only on suspend if
                                                    needed... IMHO
                                                    that's as clean as
                                                    we can get regarding
                                                    shutdown code when
                                                    the server is in
                                                    running state.<br
                                                      class="">
                                                    <br class="">
                                                    I would go with some
                                                    sort of
                                                    ActiveTransactionListener,
                                                    that would be
                                                    notified of no more
                                                    active transactions
                                                    only if the listener
                                                    is set?<br class="">
                                                    <br class="">
                                                    Something along the
                                                    lines below at ejb
                                                    side:<br class="">
                                                    <br class="">
ServerActivityCallback callback = null;<br class="">
                                                    <br class="">
                                                    public void
                                                    suspend(ServerActivityCallback
                                                    callback) {<br
                                                      class="">
                                                       <span
                                                      class="Apple-converted-space"> </span>if
                                                    (
                                                    transactionSubsystem.getActive<wbr
                                                      class="">Transactions()
                                                    &gt; 0) {<br
                                                      class="">
                                                          <span
                                                      class="Apple-converted-space"> </span>transactionSubsystem.setActive<wbr
                                                      class="">TransactionsListener(this);<br
                                                      class="">
                                                       <span
                                                      class="Apple-converted-space"> </span>}<br
                                                      class="">
                                                       <span
                                                      class="Apple-converted-space"> </span>else
                                                    {<br class="">
                                                         <span
                                                      class="Apple-converted-space"> </span>callback.done();
                                                    // done suspending<br
                                                      class="">
                                                      <span
                                                      class="Apple-converted-space"> </span>}<br
                                                      class="">
                                                    }<br class="">
                                                    <br class="">
                                                    // listener method<br
                                                      class="">
                                                    public void
                                                    noMoreActiveTransactions()
                                                    {<br class="">
                                                       <span
                                                      class="Apple-converted-space"> </span>callback.done();
                                                    // done suspending<br
                                                      class="">
                                                       <span
                                                      class="Apple-converted-space"> </span>//
                                                    then we let control
                                                    point notify clients
                                                    that this node is no
                                                    longer available<br
                                                      class="">
                                                       <span
                                                      class="Apple-converted-space"> </span>...<br
                                                      class="">
                                                    }<br class="">
                                                    <br class="">
                                                    At transactions
                                                    side:<br class="">
ActiveTransactionListener listener = null;<br class="">
                                                    <br class="">
                                                    private void
                                                    incrementTxnCount()
                                                    {<br class="">
                                                       <span
                                                      class="Apple-converted-space"> </span>...<br
                                                      class="">
                                                    }<br class="">
                                                    <br class="">
                                                    private void
                                                    decrementTxnCount()
                                                    {<br class="">
                                                      <span
                                                      class="Apple-converted-space"> </span>if
(txnCountUpdater.decrementAndG<wbr class="">et() == 0 &amp;&amp;
                                                    listener != null)<br
                                                      class="">
                                                          <span
                                                      class="Apple-converted-space"> </span>listener.noMoreActiveTransacti<wbr
                                                      class="">ons();
                                                          <span
                                                      class="Apple-converted-space"> </span><br
                                                      class="">
                                                    }<br class="">
                                                    <br class="">
                                                    public int
                                                    getActiveTransactions()
                                                    {<br class="">
                                                      <span
                                                      class="Apple-converted-space"> </span>return
txnCountUpdater.get();
                                                    <div class="">
                                                      <div
                                                        class="m_4632944962706681205m_-74571448199160184h5"><br
                                                          class="">
                                                        }<br class="">
                                                        <br class="">
                                                        <br class="">
                                                        <br class="">
                                                        <br class="">
                                                        <br class="">
                                                        <br class="">
                                                        <br class="">
                                                        <div
class="m_4632944962706681205m_-74571448199160184m_-1625616884403642138moz-cite-prefix">On
                                                          04-12-2016
                                                          20:39, Stuart
                                                          Douglas wrote:<br
                                                          class="">
                                                        </div>
                                                        <blockquote
                                                          type="cite"
                                                          class="">
                                                          <pre class="">On Sat, Dec 3, 2016 at 3:40 AM, Flavia Rainone <a moz-do-not-send="true" class="m_4632944962706681205m_-74571448199160184m_-1625616884403642138moz-txt-link-rfc2396E" href="mailto:frainone@redhat.com" target="_blank">&lt;frainone@redhat.com&gt;</a> wrote:
</pre>
                                                          <blockquote
                                                          type="cite"
                                                          class="">
                                                          <pre class="">Hi,

I'm creating this thread to discuss the remaining details of graceful
shutdown for ejb transactions.

This is more or less what I've done so far:

<a moz-do-not-send="true" class="m_4632944962706681205m_-74571448199160184m_-1625616884403642138moz-txt-link-freetext" href="https://github.com/fl4via/wildfly/commit/7017146522af9a979a8a8e0c92039e6a5fb18760" target="_blank">https://github.com/fl4via/wild<wbr class="">fly/commit/7017146522af9a979a8<wbr class="">a8e0c92039e6a5fb18760</a>

While discussing this in the hip chat yesterday, Stuart mentioned that maybe
we could have the transactions subsystem responsible for keeping track of
how many active transactions we have, instead of putting that code in
EjbRemoteTransactionsRepositor<wbr class="">y.

Stuart, does that include having the suspend callback being done at
transactions subsystem as well? I'm thinking maybe not, because there are
two points in the ejb subsystem we need to know if transactions suspension
is over:

</pre></blockquote><pre class="">No, that still has to be handled at an EJB subsystem level.
Conceptually this is similar to what was done for the XTS subsytem, so
it should probably use a similar design. Ideally while the server is
in the running state the only graceful related code that is run is the
control point request tracking, however this may not be possible.

One other thing that came up on our hipchat discussion yesterday is TX
level graceful shutdown actually has some significant drawbacks, as
you cannot send out the module unavailability message until all the
transactions have been closed. This means that while we are waiting
for transactions to complete the node will still be part of a cluster,
and clients will send it requests that will be immediately rejected.

Stuart

</pre><blockquote type="cite" class=""><pre class="">- at EjbSuspendInterceptor if it is over, no request is allowed, if it is
not over, we need to check if current invocation contains a reference to an
active transaction

- at some point, we need to let control point notify that the ejb module is
not longer available to ejb client after transaction suspension is over,
i.e., we need to do that when suspend has been requested and there are no
remaining active transactions available.

On the other hand, it is hard to draw the line between what should be in the
transactions subsystem and what shouldn't. If the callback is done at
transactions subsystem, we need a way of having ejb3 notified that it is
done. If it is not done at transactions subsystem, ejb3 has to be notified
of the active transactions going to zero, which seems a lot of overhead, so
from this point of view maybe the callback should be in the transactions
system after all.

Stuart and Gytis, any thoughts?


--
Flavia Rainone
Principal Software Engineer
JBoss EAP/WildFly Team
M: (+55) 11 981-225-466

Red Hat.
Better technology.
Faster innovation.
Powered by community collaboration.
</pre></blockquote></blockquote>
<pre class="m_4632944962706681205m_-74571448199160184m_-1625616884403642138moz-signature" cols="72">-- 
Flavia Rainone
Principal Software Engineer
JBoss EAP/WildFly Team 
M: (+55) 11 981-225-466

Red Hat.
Better technology.
Faster innovation.
Powered by community collaboration. 
</pre></div></div></div>
</div></div><span class="">______________________________<wbr class="">_________________
wildfly-dev mailing list
<a moz-do-not-send="true" href="mailto:wildfly-dev@lists.jboss.org" target="_blank" class="">wildfly-dev@lists.jboss.org</a>
<a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank" class="">https://lists.jboss.org/mailma<wbr class="">n/listinfo/wildfly-dev</a>
</span></blockquote></div><span class="m_4632944962706681205HOEnZb"><font class="" color="#888888">


--<span class="Apple-converted-space"> </span>
<div class="m_4632944962706681205m_-74571448199160184gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><font class="" size="4">Andrig (Andy) T. Miller
</font></div><font class="" size="4">Global Platform Director, Middleware
</font></div><font class="" size="4">Red Hat, Inc.</font>
</div></div></div></div></font></span></div>
______________________________<wbr class="">_________________
wildfly-dev mailing list
<a moz-do-not-send="true" href="mailto:wildfly-dev@lists.jboss.org" target="_blank" class="">wildfly-dev@lists.jboss.org</a>
<a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" rel="noreferrer" target="_blank" class="">https://lists.jboss.org/mailma<wbr class="">n/listinfo/wildfly-dev</a>
</blockquote></div></div></div>
</div></div></blockquote></div>


--<span class="Apple-converted-space"> </span>
<div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><font class="" size="4">Andrig (Andy) T. Miller
</font></div><font class="" size="4">Global Platform Director, Middleware
</font></div><font class="" size="4">Red Hat, Inc.</font>
</div></div></div></div></div></div><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">_______________________________________________</span>
<span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">wildfly-dev mailing list</span>
<a moz-do-not-send="true" href="mailto:wildfly-dev@lists.jboss.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">wildfly-dev@lists.jboss.org</a>
<a moz-do-not-send="true" href="https://lists.jboss.org/mailman/listinfo/wildfly-dev" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a></div></blockquote></div>
</div></div></div></div>

<fieldset class="mimeAttachmentHeader"></fieldset>
<pre wrap="">_______________________________________________
wildfly-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:wildfly-dev@lists.jboss.org">wildfly-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/wildfly-dev">https://lists.jboss.org/mailman/listinfo/wildfly-dev</a></pre>

</blockquote>
</body></html>