Bug 781251 - cli exits 0 if command fails due to connection issues
Summary: cli exits 0 if command fails due to connection issues
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: cli
Version: mainline
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
Assignee: Csaba Henk
QA Contact: Vijaykumar Koppad
URL:
Whiteboard:
Depends On:
Blocks: 817967
TreeView+ depends on / blocked
 
Reported: 2012-01-13 04:49 UTC by Csaba Henk
Modified: 2014-08-25 00:49 UTC (History)
4 users (show)

Fixed In Version: glusterfs-3.4.0
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-07-24 17:14:04 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Csaba Henk 2012-01-13 04:49:41 UTC
Description of problem:

The gluster cli properly exits with error code if a command was performed but failed; however, if the connection gets broken in the middle, it exits with 0 which lets the caller falsely conclude that the command succeeded.

Version-Release number of selected component (if applicable):

all >= 3.1

(the PoC code might be specific to master)

How reproducible:

deterministic

Steps to Reproduce:
1. start glusterd with "--xlator-option=management.rpc-auth-allow-insecure=off"
2. as a nonprivileged user, do "gluster --log-file=- volume info"
   # the query fails as now glusterd requires a privileged user to connect,
   # thus it closes the connection as soon as it detects that it's not the case
3. echo $?
  
Actual results:

0

Expected results:

non-zero number

Additional info:

Comment 1 Amar Tumballi 2012-02-22 05:13:34 UTC
Csaba, this bug is fixed with http://review.gluster.com/2640 right? If yes, please mark it for ON_QA

Comment 2 Kaushal 2012-05-31 10:17:09 UTC
Verified on v3.3.0qa44. With steps as described above, get proper non-zero return value.

As root,
-!- ~ » glusterd --xlator-option=management.rpc-auth-allow-insecure=off

As a normal-user,
--- ~ » gluster --log-file=- volume info
[2012-05-31 15:43:52.058710] W [rpc-transport.c:174:rpc_transport_load] 0-rpc-transport: missing 'option transport-type'. defaulting to "socket"
[2012-05-31 15:43:52.127289] W [socket.c:1512:__socket_proto_state_machine] 0-glusterfs: reading from socket failed. Error (Transport endpoint is not connected), peer (::1:24007)
[2012-05-31 15:43:52.127535] E [rpc-clnt.c:373:saved_frames_unwind] (-->/usr/local/lib/libgfrpc.so.0(rpc_clnt_notify+0xd0) [0x7fdd4c272020] (-->/usr/local/lib/libgfrpc.so.0(rpc_clnt_connection_cleanup+0xb0) [0x7fdd4c271c90] (-->/usr/local/lib/libgfrpc.so.0(saved_frames_destroy+0xe) [0x7fdd4c271bbe]))) 0-glusterfs: forced unwinding frame type(Gluster CLI) op(--(5)) called at 2012-05-31 15:43:52.127079 (xid=0x1x)

No volumes present
[2012-05-31 15:43:52.127579] I [cli-rpc-ops.c:732:gf_cli3_1_get_volume_cbk] 0-cli: Returning: -1
Connection failed. Please check if gluster daemon is operational.
[2012-05-31 15:43:52.127613] I [input.c:46:cli_batch] 0-: Exiting with: -1
--- ~ » echo $?
255
--- ~ »


Note You need to log in before you can comment on or make changes to this bug.