freescout-help-desk / freescout

FreeScout — Free self-hosted help desk & shared mailbox (Zendesk / Help Scout alternative)
https://freescout.net
GNU Affero General Public License v3.0
3.05k stars 501 forks source link

Fetch cycles blocked for 30mins following incomplete fetch cycle #3104

Closed radarsymphony closed 1 year ago

radarsymphony commented 1 year ago

Summary

Fetching does not run during the first 30mins of the hour. We have gone through the Fetching FAQ:

The first fetch cycle of the hour does not complete in its entirety. Instead, it appears to be sent "signal 15" at 2min after the hour (see logs below). For the next 30min, the fetch cycle does not run. At 32mins after the hour, the killed process times out (I think) and for the second half of the hour, all inboxes fetch every 5mins as configured.

Our Environment & Config

Fetching Sequence

To illustrate the issue, below is a typical hour ("xx" being any hour of the day):

Typical Sequence

Timeline - **`xx:00:25` Fetch cycle starts but does not complete (stops xx:02:00)** - `xx:02:00` The process has been signaled with signal "15" appears in logs (logs posted below) - `xx:05:02` Doesn't run - `xx:10:02` Doesn't run - `xx:15:02` Doesn't run - `xx:16:xx` Fetching Problems notice sent/received - `xx:20:02` Doesn't run - `xx:25:02` Doesn't run - `xx:30:02` Doesn't run - `xx:32:00` ([I think a long-running fetch command is killed here based on the code and that fetching starts working again after this point.](https://github.com/freescout-helpdesk/freescout/commit/313cd61975f8d6b65cd809429b2d4379c8355ec2#diff-3e91b9df26f6ed49ead694c97ddcddf5f3c3e878390064d0b8849f22d54e5603R111)) - **`xx:35:02` Starts running again and completes successfully** - `xx:38:xx` Fetching Recovered notice - `xx:40:02` Runs successfully - `xx:45:02` Runs successfully - `xx:50:02` Runs successfully - `xx:55:02` Runs successfully - **`xx:00:25` Fetch cycle starts but does not complete (stops xx:02:00)**
Gantt diagram ```mermaid gantt title Fetch Cycle Timeline dateFormat HH:mm:ss axisFormat %H:%M:%S section Succeeded fetch-emails :00:00:02, 95s section Failed what is delaying the start of the fetch? :00:00:00, 25s fetch-emails :f2, 00:00:25, 95s unfetched mail :after f2, 10s section Other Processes work:queue restarted? :a1, 00:02:00, 2s work:queue restarted? :a2, 00:00:00, 2s ```
Close-up of process list at 2min after hour #### 15:02:00 ![image](https://github.com/freescout-helpdesk/freescout/assets/73671474/bcd45569-4db8-4be4-abd7-87bbb18d809b) #### 15:02:02 ![image](https://github.com/freescout-helpdesk/freescout/assets/73671474/b69b75ae-1c5e-4f76-a744-e8db8e45c9da) #### 15:02:04 ![image](https://github.com/freescout-helpdesk/freescout/assets/73671474/05e48847-0069-4361-9bc7-8067ef25c410)

Logs

The process has been signaled with signal "15". {"exception":"[object] (Symfony\\Component\\Process\\Exception\\RuntimeException(code: 0): The process has been signaled with signal \"15\". at /www/html/overrides/symfony/process/Process.php:434)
Full stack trace ``` [2023-06-09 13:02:01] production.ERROR: The process has been signaled with signal "15". {"exception":"[object] (Symfony\\Component\\Process\\Exception\\RuntimeException(code: 0): The process has been signaled with signal \"15\". at /www/html/overrides/symfony/process/Process.php:434) [stacktrace] #0 /www/html/overrides/symfony/process/Process.php(212): Symfony\\Component\\Process\\Process->wait() #1 /www/html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php(201): Symfony\\Component\\Process\\Process->run() #2 /www/html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/Event.php(176): Illuminate\\Console\\Scheduling\\Event->runCommandInForeground(Object(Illuminate\\Foundation\\Application)) #3 /www/html/vendor/laravel/framework/src/Illuminate/Console/Scheduling/ScheduleRunCommand.php(59): Illuminate\\Console\\Scheduling\\Event->run(Object(Illuminate\\Foundation\\Application)) #4 [internal function]: Illuminate\\Console\\Scheduling\\ScheduleRunCommand->handle() #5 /www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(28): call_user_func_array(Array, Array) #6 /www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(87): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}() #7 /www/html/overrides/laravel/framework/src/Illuminate/Container/BoundMethod.php(27): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure)) #8 /www/html/overrides/laravel/framework/src/Illuminate/Container/Container.php(549): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application), Array, Array, NULL) #9 /www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\\Container\\Container->call(Array) #10 /www/html/vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle)) #11 /www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle)) #12 /www/html/vendor/symfony/console/Application.php(992): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #13 /www/html/vendor/symfony/console/Application.php(255): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Console\\Scheduling\\ScheduleRunCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #14 /www/html/vendor/symfony/console/Application.php(148): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #15 /www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(88): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #16 /www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Illuminate\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #17 /www/html/artisan(60): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #18 {main} "} ```

Potentially related commits

Queue retry

Questions

freescout-helpdesk commented 1 year ago

The first fetch cycle of the hour does not complete in its entirety.

It means your fetching gets stuck. You need to debug it to figure out why.