Skip to content

NethVoice: calendar synchronization runs every minute on all instances at the same second #8409

Todo

Description

@edospadoni

Every NethVoice instance starts the synchronization of external calendars every minute, exactly at second 0, even when no calendar is configured. On a node that hosts several instances all these jobs start together and keep the processor fully busy for a few seconds every minute. Instances with many calls in progress can have choppy audio in those seconds.

Steps to reproduce

  • Install several NethVoice instances on the same node, for example 11 instances on a node with 4 CPUs
  • Do not configure any calendar in the instances
  • On the node, watch the processor load second by second with vmstat 1 across the start of a minute
  • List the timers of an instance with runagent -m nethvoice1 systemctl --user list-timers

Expected behavior

An instance without calendars does not run the calendar synchronization. When the synchronization is needed, the instances of the same node do not start it all at the same second.

Actual behavior

The timer nethvoice-calendar-sync.timer runs fwconsole calendar --sync inside the freepbx container every minute at second 0, on every instance. The timer nethvoice-queue-stats-reset.timer starts at the same second.

On a node with 4 CPUs and 11 instances, none of them with a calendar, 22 jobs start together every minute. Each one takes about 1 second. The processor has no idle time for 3-4 seconds and up to 57 processes wait to run:

mm:ss  waiting  idle%
27:59        0     84
28:00        2     86
28:01       57     42
28:02       36      0
28:03       40      0
28:04       24      0
28:05        2     52
28:06        0     78

During those seconds the Asterisk process of a busy instance does not get the processor in time. In one measurement a single Asterisk thread waited 859 ms within one second. On calls answered through a queue Asterisk logs this warning, always in the first seconds of a minute:

WARNING[85077][C-0000022f] channel.c: Exceptionally long voice queue length (97 voice / 97 total) queuing to Local/218@from-queue-0000026c;2

The effect is audible only on instances with many calls at the same time. Instances with few calls on the same node log no warning.

Components

NethVoice 1.8.7 and 1.8.6. The timer exists since NethVoice 1.7.9. Measured on a NethServer 8 node with 4 CPUs and 11 NethVoice instances.

See also

Activity

  1. added this to the NethVoice 1.8 milestone on Dec 3, 2026
  2. added
    nethvoice
    on Dec 3, 2026
  3. added theissue type on Dec 3, 2026
  4. self-assigned this
    on Dec 3, 2026
  5. removed their assignment
    on Dec 4, 2026
  6. added
    testing
    on Dec 4, 2026
  7. moved this from Todo to Testing in NethVoiceon Dec 4, 2026
  8. edospadoni commented on Dec 4, 2026

    @edospadoni
    MemberAuthor

    Test

    PRs: nethesis/ns8-nethvoice#1413

    Setup: a node with two or more NethVoice instances, updated to the testing release below. The commands run inside each instance (runagent -m nethvoiceX).

    Test Case 1 - Timers no longer start together

    • systemctl --user list-timers nethvoice-calendar-sync.timer nethvoice-queue-stats-reset.timer on each instance: the two timers run once a minute, at a second that differs between instances and between the two timers (not :00 for all)
    • Check again after a few minutes and after systemctl --user daemon-reload: each timer keeps the same second
    • After the update the timers are active without manual steps

    Test Case 2 - Calendar synchronization

    • Instance with no calendar, or only local calendars: a time condition based on a local calendar still follows the calendar
    • Add a remote (iCal) calendar and change an event at the source: the change shows up in FreePBX within the calendar refresh interval, as before
    • Remove the remote calendar: no errors in the instance log (journalctl --user -u nethvoice-calendar-sync)

    Test Case 3 - Scheduled reset of queue statistics

    • Schedule a statistics reset for a queue at a given minute: the statistics are reset once, in that minute
    • Two queues scheduled in two consecutive minutes: each one is reset once, in its own minute
    • Stop nethvoice-queue-stats-reset.timer just before a scheduled reset and start it again two or three minutes later: the missed reset is done once at the restart
    • A queue without a scheduled reset keeps its statistics

    Testing release: 1.8.8-testing.48 (nethesis/ns8-nethvoice#1413)

    ghcr.io/nethesis/nethvoice:1.8.8-testing.48
    
    api-cli run update-module --data '{"module_url":"ghcr.io/nethesis/nethvoice:1.8.8-testing.48","instances":["nethvoiceX"],"force":true}'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

nethvoicetesting

Type

Projects

  • Status
    Testing

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions