[Bugs] [Bug 1687249] New: Error handling in /usr/sbin/gluster-eventsapi produces IndexError: tuple index out of range

bugzilla at redhat.com bugzilla at redhat.com
Mon Mar 11 03:42:33 UTC 2019


https://bugzilla.redhat.com/show_bug.cgi?id=1687249

            Bug ID: 1687249
           Summary: Error handling in /usr/sbin/gluster-eventsapi produces
                    IndexError: tuple index out of range
           Product: GlusterFS
           Version: 5
            Status: NEW
         Component: eventsapi
          Keywords: EasyFix, ZStream
          Assignee: bugs at gluster.org
          Reporter: avishwan at redhat.com
                CC: dahorak at redhat.com, rhs-bugs at redhat.com,
                    sanandpa at redhat.com, sankarshan at redhat.com,
                    sheggodu at redhat.com
        Depends On: 1600459, 1685027
            Blocks: 1687248
  Target Milestone: ---
    Classification: Community



+++ This bug was initially created as a clone of Bug #1685027 +++

+++ This bug was initially created as a clone of Bug #1600459 +++

Description of problem:
  During testing of RHGS WA, I've found following traceback raised from 
  /usr/sbin/gluster-eventsapi script:

  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  File "/usr/sbin/gluster-eventsapi", line 666, in <module>
    runcli()
  File "/usr/lib/python2.7/site-packages/gluster/cliutils/cliutils.py", line
224, in runcli
    cls.run(args)
  File "/usr/sbin/gluster-eventsapi", line 329, in run
    sync_to_peers(args)
  File "/usr/sbin/gluster-eventsapi", line 177, in sync_to_peers
    "{1}".format(e[0], e[2]),
  IndexError: tuple index out of range
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  The prospective real issue is hidden beside this traceback.

Version-Release number of selected component (if applicable):
  glusterfs-events-3.12.2-13.el7rhgs.x86_64

How reproducible:
  100% if you will be able to cause the raise of GlusterCmdException

Steps to Reproduce:
I'm not sure, how to reproduce it from scratch, as my knowledge related
to gluster-eventsapi is very limited, but the problem is quite well
visible from the source code:

Open /usr/sbin/gluster-eventsapi script and look for function sync_to_peers
around line 171:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
171 def sync_to_peers(args):
172     if os.path.exists(WEBHOOKS_FILE):
173         try:
174             sync_file_to_peers(WEBHOOKS_FILE_TO_SYNC)
175         except GlusterCmdException as e:
176             handle_output_error("Failed to sync Webhooks file: [Error:
{0}]"
177                                 "{1}".format(e[0], e[2]),
178                                 errcode=ERROR_WEBHOOK_SYNC_FAILED,
179                                 json_output=args.json)
180 
181     if os.path.exists(CUSTOM_CONFIG_FILE):
182         try:
183             sync_file_to_peers(CUSTOM_CONFIG_FILE_TO_SYNC)
184         except GlusterCmdException as e:
185             handle_output_error("Failed to sync Config file: [Error: {0}]"
186                                 "{1}".format(e[0], e[2]),
187                                 errcode=ERROR_CONFIG_SYNC_FAILED,
188                                 json_output=args.json)
189 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Important lines are 177 and 186:
  "{1}".format(e[0], e[2]),

The problem is, that the GlusterCmdException is raised this way[1]:
  raise GlusterCmdException((rc, out, err))
So all three parameters rc, out and err are supplied as one parameter (of type
tuple).

Actual results:
  Any problem leading to raise of GlusterCmdException is hidden beside
  above mentioned exception.

Expected results:
  There shouldn't be any such traceback.

Additional info:
[1] file /usr/lib/python2.7/site-packages/gluster/cliutils/cliutils.py

--- Additional comment from Daniel Horák on 2018-07-13 08:23:29 UTC ---

Possible Reproduction scenario might be, to remove (rename)
/var/lib/glusterd/events/ directory on one Gluster Storage Node and try to add
webhook from another storage node:

On Gluster node 5:
  # mv /var/lib/glusterd/events/ /var/lib/glusterd/events_BACKUP

On Gluster node 1:
  # gluster-eventsapi webhook-add http://0.0.0.0:8697/test
  Traceback (most recent call last):
    File "/usr/sbin/gluster-eventsapi", line 666, in <module>
      runcli()
    File "/usr/lib/python2.7/site-packages/gluster/cliutils/cliutils.py", line
224, in runcli
      cls.run(args)
    File "/usr/sbin/gluster-eventsapi", line 329, in run
      sync_to_peers(args)
    File "/usr/sbin/gluster-eventsapi", line 177, in sync_to_peers
      "{1}".format(e[0], e[2]),
  IndexError: tuple index out of range

--- Additional comment from Worker Ant on 2019-03-04 08:17:52 UTC ---

REVIEW: https://review.gluster.org/22294 (eventsapi: Fix error while handling
GlusterCmdException) posted (#1) for review on master by Aravinda VK

--- Additional comment from Worker Ant on 2019-03-06 13:22:53 UTC ---

REVIEW: https://review.gluster.org/22294 (eventsapi: Fix error while handling
GlusterCmdException) merged (#2) on master by Amar Tumballi


Referenced Bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1600459
[Bug 1600459] Error handling in /usr/sbin/gluster-eventsapi produces
IndexError: tuple index out of range
https://bugzilla.redhat.com/show_bug.cgi?id=1685027
[Bug 1685027] Error handling in /usr/sbin/gluster-eventsapi produces
IndexError: tuple index out of range
https://bugzilla.redhat.com/show_bug.cgi?id=1687248
[Bug 1687248] Error handling in /usr/sbin/gluster-eventsapi produces
IndexError: tuple index out of range
-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Bugs mailing list