[Home]

Summary:ASTERISK-28858: app_queue: Realtime linear queues losing the order of agents
Reporter:Leandro Dardini (ldardini)Labels:
Date Opened:2020-04-28 01:34:55Date Closed:
Priority:MinorRegression?
Status:Open/NewComponents:Applications/app_queue
Versions:16.9.0 Frequency of
Occurrence
Constant
Related
Issues:
is duplicated byASTERISK-29471 Realtime queue_members does not respect linear strategy
Environment:Asterisk 16.9.0 on CentOS 7 64bit, realtime configuration on MySQL 5.7Attachments:
Description:I have a system with several queues in a realtime configuration, using MySQL 5.7 as backend database. After restarting asterisk, for a limited amount of time, the ordering of the agents is perfect. As far as I know, the ordering of agents is made based on the device name, so agents are named as following, starting from AG-000 to AG-021

{quote}
asterisk -rx 'queue show 3641'
3641 has 0 calls (max unlimited) in 'linear' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0%, SL2:0.0% within 30s
  Members:
     236 (Local/AG-000-NFR-16324@fromotherpbx/n from Custom:236-14687) (ringinuse enabled) (realtime) (Not in use) has taken no calls yet
     232 (Local/AG-001-NFR-16348@fromotherpbx/n from Custom:232-14687) (ringinuse enabled) (realtime) (Not in use) has taken no calls yet
     226 (Local/AG-002-NFR-17993@fromotherpbx/n from Custom:226-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     234 (Local/AG-003-NFR-16340@fromotherpbx/n from Custom:234-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     206 (Local/AG-004-NFR-16332@fromotherpbx/n from Custom:206-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     210 (Local/AG-005-NFR-16300@fromotherpbx/n from Custom:210-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     211 (Local/AG-006-NFR-16356@fromotherpbx/n from Custom:211-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     213 (Local/AG-007-NFR-16412@fromotherpbx/n from Custom:213-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     215 (Local/AG-008-NFR-16372@fromotherpbx/n from Custom:215-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     217 (Local/AG-009-NFR-16380@fromotherpbx/n from Custom:217-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     218 (Local/AG-010-NFR-16404@fromotherpbx/n from Custom:218-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     219 (Local/AG-011-NFR-16388@fromotherpbx/n from Custom:219-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     220 (Local/AG-012-NFR-16396@fromotherpbx/n from Custom:220-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     224 (Local/AG-013-NFR-16428@fromotherpbx/n from Custom:224-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     230 (Local/AG-014-NFR-16308@fromotherpbx/n from Custom:230-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     231 (Local/AG-015-NFR-16364@fromotherpbx/n from Custom:231-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     238 (Local/AG-016-NFR-16444@fromotherpbx/n from Custom:238-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     240 (Local/AG-017-NFR-16316@fromotherpbx/n from Custom:240-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     241 (Local/AG-018-NFR-16420@fromotherpbx/n from Custom:241-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     243 (Local/AG-019-NFR-16460@fromotherpbx/n from Custom:243-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     246 (Local/AG-020-NFR-16292@fromotherpbx/n from Custom:246-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     205 (Local/AG-021-NFR-16452@fromotherpbx/n from Custom:205-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
  No Callers
{quote}

After a few hours, even if there was no call processed in the queue, the ordering is lost. The only activity in the queue is a "queue show" command run every minute.

{quote}
asterisk -rx 'queue show 3641'
3641 has 0 calls (max unlimited) in 'linear' strategy (0s holdtime, 0s talktime), W:0, C:0, A:0, SL:0.0%, SL2:0.0% within 30s
  Members:
     232 (Local/AG-001-NFR-16348@fromotherpbx/n from Custom:232-14687) (ringinuse enabled) (realtime) (Not in use) has taken no calls yet
     234 (Local/AG-003-NFR-16340@fromotherpbx/n from Custom:234-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     206 (Local/AG-004-NFR-16332@fromotherpbx/n from Custom:206-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     210 (Local/AG-005-NFR-16300@fromotherpbx/n from Custom:210-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     211 (Local/AG-006-NFR-16356@fromotherpbx/n from Custom:211-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     213 (Local/AG-007-NFR-16412@fromotherpbx/n from Custom:213-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     215 (Local/AG-008-NFR-16372@fromotherpbx/n from Custom:215-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     217 (Local/AG-009-NFR-16380@fromotherpbx/n from Custom:217-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     218 (Local/AG-010-NFR-16404@fromotherpbx/n from Custom:218-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     219 (Local/AG-011-NFR-16388@fromotherpbx/n from Custom:219-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     220 (Local/AG-012-NFR-16396@fromotherpbx/n from Custom:220-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     224 (Local/AG-013-NFR-16428@fromotherpbx/n from Custom:224-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     230 (Local/AG-014-NFR-16308@fromotherpbx/n from Custom:230-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     231 (Local/AG-015-NFR-16364@fromotherpbx/n from Custom:231-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     238 (Local/AG-016-NFR-16444@fromotherpbx/n from Custom:238-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     240 (Local/AG-017-NFR-16316@fromotherpbx/n from Custom:240-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     241 (Local/AG-018-NFR-16420@fromotherpbx/n from Custom:241-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (In use) has taken no calls yet
     243 (Local/AG-019-NFR-16460@fromotherpbx/n from Custom:243-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     246 (Local/AG-020-NFR-16292@fromotherpbx/n from Custom:246-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     205 (Local/AG-021-NFR-16452@fromotherpbx/n from Custom:205-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
     226 (Local/AG-000-NFR-17993@fromotherpbx/n from Custom:226-14687) (ringinuse enabled) (realtime) (Not in use) has taken no calls yet
     236 (Local/AG-002-NFR-16324@fromotherpbx/n from Custom:236-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
  No Callers
{quote}
Comments:By: Asterisk Team (asteriskteam) 2020-04-28 01:34:56.632-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

Please note that once your issue enters an open state it has been accepted. As Asterisk is an open source project there is no guarantee or timeframe on when your issue will be looked into. If you need expedient resolution you will need to find and pay a suitable developer. Asking for an update on your issue will not yield any progress on it and will not result in a response. All updates are posted to the issue when they occur.

By: Kevin Harwell (kharwell) 2020-04-28 16:20:27.366-0500

When using a linear (as used here) strategy items from the database get added to an internal list in the order received (or returned from the database). However, they are not sorted unless they already are in the database, or returned by the database as such.

In this case it appears some of your database records were updated (or removed and re-added) between calls to "show queue". In your example specifically the first, and third records.

From first "show" (236 & 226 are at the beginning):
{noformat}
236 (Local/AG-000-NFR-16324@fromotherpbx/n from Custom:236-14687) (ringinuse enabled) (realtime) (Not in use) has taken no calls yet
...
226 (Local/AG-002-NFR-17993@fromotherpbx/n from Custom:226-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
...
{noformat}
From second "show" (226 & 236 are at the end):
{noformat}
...
226 (Local/AG-000-NFR-17993@fromotherpbx/n from Custom:226-14687) (ringinuse enabled) (realtime) (Not in use) has taken no calls yet
236 (Local/AG-002-NFR-16324@fromotherpbx/n from Custom:236-14687) (ringinuse enabled) (realtime) (paused was 0 secs ago) (Not in use) has taken no calls yet
{noformat}
Note between the two how the interfaces have swapped. My guess is these records either now exist at the end of the table in the database, or the data is ordered somehow by prior to returning to put these at the end (like by last change date or something).

By: Kevin Harwell (kharwell) 2020-04-28 16:23:51.838-0500

Closing as this is not really a bug, but how the database values are retrieved. Any change that would want to sort records Asterisk side would be an improvement/new feature.

By: Leandro Dardini (ldardini) 2020-04-30 02:57:22.186-0500

You are right. My assumption was wrong. The ordering in the queue is not done over the "membername" (maybe it was this way in some old asterisk version?) but it is made over the "uniqueid". That field is a Primary Key, so the result from any MySQL command is returned ordered by that field.

Thank you to all

By: Asterisk Team (asteriskteam) 2020-04-30 02:57:23.128-0500

This issue has been reopened as a result of your commenting on it as the reporter. It will be triaged once again as applicable.

By: Joshua C. Colp (jcolp) 2020-04-30 11:01:00.230-0500

We're going to keep this open since it's a reasonable expectation for app_queue to linearize things just in case.

By: Kevin Harwell (kharwell) 2020-04-30 11:04:36.492-0500

It seems the word "linear" is a bit ambiguous, and this could be seen as a bug. So opening as such.