[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2022-01-07 Thread Sean Busbey (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17470997#comment-17470997
 ] 

Sean Busbey commented on HBASE-26469:
-

HBASE-26543 has landed now, so I can resume getting together a master version 
of the patch.

{quote}
Moreso than anything, for a patch release, we shouldn't be changing 
functionality (especially if folks are running in a script that set -e's).
{quote}

so far there has been a plan to land some version of this patch on branch-2.4. 
[~elserj] are you asking that whatever patch lands maintain the behavior 
present in 2.4.8?

this is the current behavior in 2.4.x (which is different from prior 2.x 
release lines):

||script passed by|| clean exit code|| error exit code||
|cli, default|  1| 1*|
|cli, -n | 1 | 1*|
|stdin, default| 0 | 0|
|stdin, -n| 1*|1*|

this is what Mike and I were discussing it ought to be (and matches 2.3 and 
earlier):


||script passed by|| clean exit code|| error exit code||
|cli, default|  0| 1|
|cli, -n | 0 | 1|
|stdin, default| 0 | 0|
|stdin, -n| 1|1|

Note that this change to match 2.3 and earlier release lines would fail in a 
script with {{-e}} in fewer invocation combinations than prior 2.4.z patch 
releases

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.6.0, 2.4.10
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2022-01-07 Thread Josh Elser (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17470964#comment-17470964
 ] 

Josh Elser commented on HBASE-26469:


Read through everything (including the original HBASE-11655 doc) and agree with 
the plan set here. Moreso than anything, for a patch release, we shouldn't be 
changing functionality (especially if folks are running in a script that 
{{{}set -e{}}}'s).

 
{quote}cli, default, error exit code (top right cell) should return 1. in patch 
it returns 0. historically this has returned 1. I do not believe we are helping 
operations folks by changing what this mode returns.
{quote}
This also makes sense to me.

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.6.0, 2.4.10
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-17 Thread Sean Busbey (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17461614#comment-17461614
 ] 

Sean Busbey commented on HBASE-26469:
-

okay I can get behind that.

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:231
>   eval_io at uri:classloader:/shell.rb:326
>   classpath:/jar-bootstrap.rb at classpath:/jar-bootstrap.rb:194
> exception_handler at uri:classloader:/shell.rb:339
> at classpath:/jar-bootstrap.rb:194
> {code}
> And in our version of IRB (0.9.6) [line 30 for 
> 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-15 Thread Mike Drob (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17460369#comment-17460369
 ] 

Mike Drob commented on HBASE-26469:
---

cli, default, error exit code (top right cell) should return 1. in patch it 
returns 0. historically this has returned 1. I do not believe we are helping 
operations folks by changing what this mode returns.

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:231
>   eval_io at uri:classloader:/shell.rb:326
>   classpath:/jar-bootstrap.rb at classpath:/jar-bootstrap.rb:194
> exception_handler at uri:classloader:/shell.rb:339
> 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-15 Thread Sean Busbey (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17460324#comment-17460324
 ] 

Sean Busbey commented on HBASE-26469:
-

just to make sure we're on the same page. This is the current patch results:

||script passed by|| clean exit code|| error exit code||
|cli, default|  0| 0|
|cli, -n | 0 | 1|
|stdin, default| 0 | 0|
|stdin, -n| 0|1|

I believe this is inline with the existing docs.

could you post the table for what you think it should be?

could you confirm wether or not you would want docs updated to match said table?


> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  each_top_level_statement at 
> 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-15 Thread Mike Drob (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17460260#comment-17460260
 ] 

Mike Drob commented on HBASE-26469:
---

Current patch returns 0 status when shell is passed as a cli argument in 
default interactive mode. I do not think that is correct. I agree with the rest 
of your approach.

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:231
>   eval_io at uri:classloader:/shell.rb:326
>   classpath:/jar-bootstrap.rb at classpath:/jar-bootstrap.rb:194
> exception_handler at uri:classloader:/shell.rb:339
> at 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-09 Thread Sean Busbey (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17456680#comment-17456680
 ] 

Sean Busbey commented on HBASE-26469:
-

are you good with this approach?

* Match current patch results on master, branch-2, branch-2.5 (presuming before 
2.5.0 goes out)
* update branch-2.4 to match branch-2.3 behavior

if so I'll get updated patches put up. I think testing branches other than 2.4 
will be blocked on HBASE-26543

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:231
>   eval_io at uri:classloader:/shell.rb:326
>   classpath:/jar-bootstrap.rb at 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-09 Thread Mike Drob (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17456568#comment-17456568
 ] 

Mike Drob commented on HBASE-26469:
---

Ok, thank you. Then I'm -1 on the current patch because it doesn't do what we 
claim. :)

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:231
>   eval_io at uri:classloader:/shell.rb:326
>   classpath:/jar-bootstrap.rb at classpath:/jar-bootstrap.rb:194
> exception_handler at uri:classloader:/shell.rb:339
> at classpath:/jar-bootstrap.rb:194
> {code}
> And in our version of IRB (0.9.6) [line 30 for 
> 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-09 Thread Sean Busbey (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17456558#comment-17456558
 ] 

Sean Busbey commented on HBASE-26469:
-


{quote}1. For HBase 2.4.9, clean_exit.rb passed as a cli argument should return 
0. This is different from 2.4.8 but the same as 2.3.x
{quote}
yes, I agree with this statement.

{quote}2. For HBase 2.4.9, clean_exit.rb passed via stdin with non-interactive 
mode should return 1. This is different from what the current proposed PR does 
and will require special logic to detect this for keeping backward 
compatibility.
{quote}

yes, I agree with this statement.

{quote}3. For HBase 2.5.0, clean_exit.rb passed via stdin with non-interactive 
mode should return 0. This is different from 2.3.x and 2.4.x
{quote}

yes, I agree with this statement.

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-09 Thread Mike Drob (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17456537#comment-17456537
 ] 

Mike Drob commented on HBASE-26469:
---

bq. I am hesitant to change exit codes in patch releases. I think the 
additional error indicating exit codes that happen on 2.4.y are disruptive 
enough for those migrating from 2.3 and earlier that branch-2.4 should be 
updated to match the behavior in 2.3. (edited for clarity, thanks Mike)

Still somewhat confused. Please confirm each of the following statements 
individually:

1. For HBase 2.4.9, clean_exit.rb passed as a cli argument should return 0. 
This is different from 2.4.8 but the same as 2.3.x
2. For HBase 2.4.9, clean_exit.rb passed via stdin with non-interactive mode 
should return 1. This is different from what the current proposed PR does and 
will require special logic to detect this for keeping backward compatibility.
3. For HBase 2.5.0, clean_exit.rb passed via stdin with non-interactive mode 
should return 0. This is different from 2.3.x and 2.4.x

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Fix For: 2.5.0, 2.4.9, 2.6.0
>
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-08 Thread Sean Busbey (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17455992#comment-17455992
 ] 

Sean Busbey commented on HBASE-26469:
-

{quote}
What is the intent here? For 2.4 to match what 2.3 did (despite some of the 
behavior being arguably wrong?) Or to correct some of the behavior now that we 
know about it?
{quote}

I would like to correct the behavior now that we know about it to match what is 
documented (in the cli help and ref guide as of HBASE-11658 and HBASE-11655. I 
think probably this would be fine with a release note for 2.5+.

I would like the fix to go as far back as possible, but I am hesitant to change 
exit codes in patch releases. I think the change from 2.3 -> 2.4 is disruptive 
enough that branch-2.4 is disruptive enough that we should probably make that 
branch match 2.3.

 
{quote}
 I don't remember the conventions, but maybe cli input should always be 
non-interactive? I am confident that we've had these conversations in the past.
{quote}

I don't remember where the conversation happened but the `–-noninteractive` was 
expressly opt-in to avoid folks getting blown up in operations who didn't 
expect the shell to return non-zero basically ever. Maybe we can revisit that 
in a follow-on for hbase 3?

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-08 Thread Mike Drob (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17455977#comment-17455977
 ] 

Mike Drob commented on HBASE-26469:
---

I tested the patch as written for branch-2.4 (commit aff038af099f98)

And got the following output:

{noformat}
mdrob-imp:~/code/hbase $ ./bin/hbase shell clean_exit.rb > /dev/null 2>&1 ; 
echo $?
0
mdrob-imp:~/code/hbase $ ./bin/hbase shell --noninteractive clean_exit.rb > 
/dev/null 2>&1 ; echo $?
0
mdrob-imp:~/code/hbase $ ./bin/hbase shell --noninteractive < clean_exit.rb > 
/dev/null 2>&1 ; echo $?
0
mdrob-imp:~/code/hbase $ ./bin/hbase shell < clean_exit.rb > /dev/null 2>&1 ; 
echo $?
0


mdrob-imp:~/code/hbase $ ./bin/hbase shell < error_exit.rb > /dev/null 2>&1 ; 
echo $?
0
mdrob-imp:~/code/hbase $ ./bin/hbase shell -n < error_exit.rb > /dev/null 2>&1 
; echo $?
1
mdrob-imp:~/code/hbase $ ./bin/hbase shell -n error_exit.rb > /dev/null 2>&1 ; 
echo $?
1
mdrob-imp:~/code/hbase $ ./bin/hbase shell error_exit.rb > /dev/null 2>&1 ; 
echo $?
0
{noformat}

All of the "clean exit" ones were clean, which is a change in behavior from the 
non interactive script on stdin behavior in the past.

The error exit for cli "interactive" mode also changed from the previous 2.3 
behavior. I don't remember the conventions, but maybe cli input should always 
be non-interactive? I am confident that we've had these conversations in the 
past.

What is the intent here? For 2.4 to match what 2.3 did (despite some of the 
behavior being arguably wrong?) Or to correct some of the behavior now that we 
know about it?

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Assignee: Sean Busbey
>Priority: Critical
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private 

[jira] [Commented] (HBASE-26469) HBase shell has changed exit behavior

2021-12-06 Thread Sean Busbey (Jira)


[ 
https://issues.apache.org/jira/browse/HBASE-26469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17454223#comment-17454223
 ] 

Sean Busbey commented on HBASE-26469:
-

I found why the PR behaves differently on master branch. It looks like 
HBASE-24772 broke our ability to pass in a script to run.

> HBase shell has changed exit behavior
> -
>
> Key: HBASE-26469
> URL: https://issues.apache.org/jira/browse/HBASE-26469
> Project: HBase
>  Issue Type: Bug
>  Components: shell
>Affects Versions: 2.5.0, 3.0.0-alpha-2, 2.4.8
>Reporter: Sean Busbey
>Priority: Critical
> Attachments: hbase-1.4.14-exit-behavior.log, 
> hbase-1.7.1-exit-behavior.log, hbase-2.0.6-exit-behavior.log, 
> hbase-2.1.9-exit-behavior.log, hbase-2.2.7-exit-behavior.log, 
> hbase-2.3.7-exit-behavior.log, hbase-2.4.8-exit-behavior.log, 
> hbase-3.0.0-alpha-2-exit-behavior.log
>
>
> The HBase shell has changed behavior in a way that breaks being able to exit 
> properly.
> Two example scripts to act as stand ins for hbase shell scripts to "do 
> something simple then exit":
> {code}
> tmp % echo "list\nexit" > clean_exit.rb
> tmp % echo "list\nexit 1" > error_exit.rb
> {code}
> Giving these two scripts is possible:
> * passed as a cli argument
> * via redirected stdin
> Additionally the shell invocation can be:
> * in the default compatibility mode
> * with the "non interactive" flag that gives an exit code that reflects 
> runtime errors
> I'll post logs of the details as attachments but here are some tables of the 
> exit codes.
> The {{clean_exit.rb}} invocations ought to exit with success, exit code 0.
> || ||  1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 
> || master ||
> | cli, default |0 |0   |0   |0   |0   |0   |1   | 
>1*   |
> | cli, -n | 0 |0   |0   |0   |0   |0   |1   | 
>  hang   |
> | stdin, default |  0 |0   |0   |0   |0   |0   |0   | 
>0|
> | stdin, -n |   1 |1   |1   |1   |1   |1   |1*  | 
>1*   |
> The {{error_exit.rb}} invocation should return a non-zero exit code, unless 
> we're specifically trying to match a normal hbase shell session.
> || || 1.4.14 || 1.7.1 || 2.0.6 || 2.1.9 || 2.2.7 || 2.3.7 || 2.4.8 || 
> master ||
> | cli, default |   1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> | cli, -n |1 |1   |1   |1   |1   |1   |1*  |  
> hang   |
> | stdin, default | 0 |0   |0   |0   |0   |0   |0   |  
>   0|
> | stdin, -n |  1 |1   |1   |1   |1   |1   |1*  |  
>   1*   |
> In cases marked with * the error details are different.
> The biggest concern are the new-to-2.4 non-zero exit code when we should have 
> a success and the hanging.
> The former looks like this:
> {code}
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> {code}
> The change in error details for the error exit script also shows this same 
> detail.
> This behavior appears to be a side effect of HBASE-11686. As far as I can 
> tell, the IRB handling of 'exit' calls fail because we implement our own 
> handling of sessoins rather than rely on the intended session interface. We 
> never set a current session, and IRB's exit implementation presumes there 
> will be one.
> Running in debug shows this in a stacktrace:
> {code}
> Took 0.4563 seconds
> ERROR NoMethodError: private method `exit' called for nil:NilClass
> NoMethodError: private method `exit' called for nil:NilClass
>  irb_exit at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/extend-command.rb:30
>  evaluate at stdin:2
>  eval at org/jruby/RubyKernel.java:1048
>  evaluate at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/workspace.rb:85
>   eval_io at uri:classloader:/shell.rb:327
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:246
>  loop at org/jruby/RubyKernel.java:1442
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:232
> catch at org/jruby/RubyKernel.java:1189
>  each_top_level_statement at 
> uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/irb/ruby-lex.rb:231
>   eval_io at uri:classloader:/shell.rb:326
>   classpath:/jar-bootstrap.rb at classpath:/jar-bootstrap.rb:194
> exception_handler at uri:classloader:/shell.rb:339
> at classpath:/jar-bootstrap.rb:194
> {code}
> And in our version of IRB (0.9.6) [line 30 for 
>