Bug 781251 - cli exits 0 if command fails due to connection issues
cli exits 0 if command fails due to connection issues
Product: GlusterFS
Classification: Community
Component: cli (Show other bugs)
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Csaba Henk
Vijaykumar Koppad
Depends On:
Blocks: 817967
  Show dependency treegraph
Reported: 2012-01-12 23:49 EST by Csaba Henk
Modified: 2014-08-24 20:49 EDT (History)
4 users (show)

See Also:
Fixed In Version: glusterfs-3.4.0
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2013-07-24 13:14:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Csaba Henk 2012-01-12 23:49:41 EST
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:


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:


Expected results:

non-zero number

Additional info:
Comment 1 Amar Tumballi 2012-02-22 00:13:34 EST
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 06:17:09 EDT
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 $?
--- ~ »

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