Project

General

Profile

Bug #11330

Inventory endpoint info api is reporting saturated off by one

Added by Janos Mattyasovszky 16 days ago. Updated 14 days ago.

Status:
Released
Priority:
N/A
Category:
Web - Nodes & inventories
Target version:
Target version (plugin):
Severity:
Minor - inconvenience | misleading | easy workaround
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Very Small
Priority:
49

Description

I got this back from the API endpoint while testing the inventory uploader:

{"queueMaxSize":50, "queueFillCount":49, "queueSaturated":true}

I have tested on: rudder-inventory-endpoint-4.1.5.release-1.SLES.11


Related issues

Related to Rudder - User story #9976: API endpoint to get information about queue status of uploaded inventories Released

Associated revisions

Revision 8c460847
Added by François ARMAND 15 days ago

Fixes #11330: Inventory endpoint info api is reporting saturated off by one

History

#1 Updated by Janos Mattyasovszky 16 days ago

  • Related to User story #9976: API endpoint to get information about queue status of uploaded inventories added

#2 Updated by Janos Mattyasovszky 16 days ago

In #9976 the example shows saturated when both are equal:

{
  "queueMaxSize": 200,
  "queueFillCount": 200,
  "queueSaturated": true
}

There is something bogus here :)

#3 Updated by François ARMAND 15 days ago

The code is:

  lazy val queueSize = AtomicInt(0)
  ....

  def queueInfo() {
    ...
    val current = queueSize.get
    val saturated = (current+1) >= maxQueueSize
    val code = if(saturated) HttpStatus.TOO_MANY_REQUESTS else HttpStatus.OK
    ...
  }

  ...
  // see if you can add a file
  val canDo = synchronized {
    if(queueSize.incrementAndGet(1) <= maxQueueSize) {
      // the decrement will be done by the report processor
      true
    } else {
    ....

So for maxQueue = 50, in info, current queue = 49, +1 = 50 >= 50 => "saturated".
In canDo, current = 49, incrementAndGet(1) = 50 <= 50 => true

#4 Updated by François ARMAND 15 days ago

  • Category set to Web - Nodes & inventories
  • Assignee set to François ARMAND
  • Target version set to 4.1.8
  • User visibility changed from Infrequent - complex configurations | third party integrations to Operational - other Techniques | Technique editor | Rudder settings
  • Effort required set to Very Small
  • Priority changed from 22 to 49

#5 Updated by François ARMAND 15 days ago

  • Status changed from New to In progress

#6 Updated by François ARMAND 15 days ago

  • Status changed from In progress to Pending technical review
  • Assignee changed from François ARMAND to Nicolas CHARLES
  • Pull Request set to https://github.com/Normation/ldap-inventory/pull/119

#7 Updated by François ARMAND 15 days ago

  • Status changed from Pending technical review to Pending release

#8 Updated by Vincent MEMBRÉ 14 days ago

  • Target version changed from 4.1.8 to 4.1.7

#9 Updated by Vincent MEMBRÉ 14 days ago

  • Status changed from Pending release to Released

This bug has been fixed in Rudder 4.1.7 and 4.2.0~rc1 which were released today.

Also available in: Atom PDF