Bug 1090958 - It takes up to 24 seconds to get GroupOperationHistories after a operation was scheduled via CLI
Summary: It takes up to 24 seconds to get GroupOperationHistories after a operation wa...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: RHQ Project
Classification: Other
Component: Operations
Version: 4.11
Hardware: Unspecified
OS: Unspecified
unspecified
medium vote
Target Milestone: ---
: RHQ 4.12
Assignee: RHQ Project Maintainer
QA Contact: Mike Foley
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-04-24 13:15 UTC by Filip Brychta
Modified: 2014-12-15 11:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-15 11:35:47 UTC


Attachments (Terms of Use)

Description Filip Brychta 2014-04-24 13:15:11 UTC
Description of problem:
This issue was discovered by automation which tests functions from CLI client sample file deploy-to-and-restart-JBAS.js.

Following part taken from deploy-to-and-restart-JBAS.js shows the problem:

var schedule = OperationManager.scheduleGroupOperation(group.id, resourceIds, false, operationName, conf, 0, 0, 0, 0, null);

    // now we need to wait for all the individual operations on resources to
    // complete
    var crit = new GroupOperationHistoryCriteria;
    crit.addFilterJobId(new JobId(schedule.jobName, schedule.jobGroup));

    while (true) {
        // XXX should this be configurable?
        // we're waiting for an AS to start/shutdown which takes time..
        // Let's check in 5s intervals.
        // We're waiting at the start of this loop to also ensure that the server
        // had time to issue the quartz job and persist the history entry.
        java.lang.Thread.currentThread().sleep(5000);

        var results = OperationManager.findGroupOperationHistoriesByCriteria(crit);

        if (results.empty) {
            throw "Could not find operation history for schedule " + schedule + ". This should not happen.";
        }

        var history = results.get(0);

        if (history.status != OperationRequestStatus.INPROGRESS) {
            return history;
        }
    } 


Operation was scheduled but sometimes an error "Could not find operation history for schedule ..... This should not happen." was thrown. This means that no GroupOperationHistories were returned even though the script waits 5 seconds after the operation was scheduled. I added another test which showed that it takes up to 24 seconds to get GroupOperationHistories after a operation was scheduled. 

Version-Release number of selected component (if applicable):
Version :	
4.11.0-SNAPSHOT
Build Number :	
251d60a

How reproducible:
3/4 by our automation which runs on HA environment. I'm not able to reproduce it on a simple single node environment.


Additional info:
One way of fixing this (just making the test pass) would be a fix in deploy-to-and-restart-JBAS.js sample script (e.g. add a waiting for GroupOperationHistories to be available with some timeout). But more important question is if it is expected that it can take so long.

Comment 1 Lukas Krejci 2014-05-21 08:41:07 UTC
commit 49b73f38211ba2078d38cd4e579159aba0ab8385
Author: Filip Brychta <fbrychta@redhat.com>
Date:   Wed May 21 10:37:08 2014 +0200

    [BZ 1090958] Improve waiting for operation results in sample CLI scripts

Comment 2 Heiko W. Rupp 2014-12-15 11:35:47 UTC
Bulk close of items fixed in RHQ 4.12

If you think this is not solved, then please open a *new* BZ and link to this one.


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