drush p:queue-work fails when log_stdout is enabled

Created on 1 June 2023, almost 2 years ago
Updated 22 September 2023, over 1 year ago

Problem/Motivation

When the log_stdout module is enabled, drush p:queue-work fails with an "Inter-process communication failure: invalid JSON." error.

With log_stdout enabled, I get:

root@projectname-app-3:/var/www/html# ./vendor/bin/drush p:queue-work
[DEBUG] [custom_drush_module] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  | ip:  127.0.0.1 | link: 
[DEBUG] [custom_drush_module] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  | ip:  127.0.0.1 | link: 
[DEBUG] [custom_drush_module2] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  | ip:  127.0.0.1 | link: 
[DEBUG] [custom_drush_module3] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  | ip:  127.0.0.1 | link: 

In QueueCommands.php line 525:
                                                                                                                                                                    
  Inter-process communication failure: invalid JSON.                                                                                                                
                                                                                                                                                                    
  Output: [DEBUG] [custom_drush_module] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  
    | ip:  127.0.0.1 | link:                                                                                                                                        
  [DEBUG] [custom_drush_module] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  | ip:   
   127.0.0.1 | link:                                                                                                                                                
  [DEBUG] [custom_drush_module2] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  | ip:  12  
  7.0.0.1 | link:                                                                                                                                                   
  [DEBUG] [custom_drush_module3] [2023-06-01T12:55:23] Loaded custom_module_a entity. ID: id. | uid: 0 | request-uri: http://default/ | refer:  
    | ip:  127.0.0.1 | link:                                                                                                                                        
  {                                                                                                                                                                 
      "error": null,                                                                                                                                                
      "total": 100,                                                                                                                                                 
      "processing": 0,                                                                                                                                              
      "succeeded": 100,                                                                                                                                             
      "failed": 0,                                                                                                                                                  
      "not_supported": 0                                                                                                                                            
  } 

After uninstalling log_stdout, I get:

root@projectname-app-3:/var/www/html# ./vendor/bin/drush p:queue-work
 ------------------------ ----- 
  Succeeded                100  
  Failed                   0    
  Currently invalidating   0    
  Not supported            0    
 ------------------------ -----

Steps to reproduce

* Install purge, drush, and log_stdout
* Get stuff setup so drush p:queue-work will need to do something.
* Run drush p:queue-work. If log_stdout is installed, it will fail. If log_stdout is uninstalled, it will work.

Proposed resolution

If I'm reading QueueCommands.php 507+ correctly, the solution likely would be to not expect only output from the queue-work command to appear on the command line.

Also, when I've written drush commands, if I need to call one from another command, I just call the method directly. So, the whole:

$subproc = Drush::drush($self, 'p:queue-work', [], $opt);

Has me scratching my head a little bit. Maybe just call $this->QueueWork() directly?

Not sure of that since I'm not sure why it's done the way it is done.

I'll go see why my custom drush commands are outputting debug logs when debug logging it turned off, but I do still think the Purge command needs to not expect only it's own output to show up.

Thanks in advance.

πŸ› Bug report
Status

Active

Version

3.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jerrac

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024