files_antivirus icon indicating copy to clipboard operation
files_antivirus copied to clipboard

ClamAV Deamon (Socket) - stream_socket_client(): unable to connect to unix: clamd.ctl (Resource temporarily unavailable)

Open SpontEIN opened this issue 7 years ago • 0 comments

Hi,

My Nextcloud server is using the ClamAV Antivirus App running as Deamon (Socket). The setup followed the setup here: https://docs.nextcloud.com/server/12/admin_manual/configuration_server/antivirus_configuration.html

Steps to reproduce

  1. Unclear - happens some times when files are uploaded to nextcloud
  2. ...

Error Behavior

When one of my users uploaded a file yesterday night, the server got caught in a loop. The loop continuously produces the following error msgs:

Error files_antivirus OCA\Files_Antivirus\BackgroundScanner::run, exception: Cannot connect to “/var/run/clamav/clamd.ctl”: Resource temporarily unavailable (code 11)

Error PHP stream_socket_client(): unable to connect to unix:///var/run/clamav/clamd.ctl (Resource temporarily unavailable) at /var/www/nextcloud/apps/files_antivirus/lib/Scanner/External.php#29

The server is throwing these error msgs at maximum CPU-capacity, so that it is fully occupied and not accessible anymore (also not via ssh). Hard-reboot was my only option to terminate it.

I am not sure if it is really connected to the file uploads, but the the nginx error.log (see below) suggests it.

Server configuration

Nextcloud version: 12.0.2 Operating system and version: Ubuntu 16.04.3 LTS Apache or nginx: nginx/1.13.0 PHP version: PHP 7.1.8

Where did you install Nextcloud from: nextcloud.com

List of activated apps: Enabled:

  • activity: 2.5.2
  • admin_audit: 1.2.0
  • bookmarks: 0.10.1
  • bruteforcesettings: 1.0.2
  • calendar: 1.5.3
  • comments: 1.2.0
  • contacts: 1.5.3
  • dav: 1.3.0
  • encryption: 1.6.0
  • federatedfilesharing: 1.2.0
  • federation: 1.2.0
  • files: 1.7.2
  • files_antivirus: 1.1.0
  • files_external: 1.3.0
  • files_pdfviewer: 1.1.1
  • files_sharing: 1.4.0
  • files_texteditor: 2.4.1
  • files_trashbin: 1.2.0
  • files_versions: 1.5.0
  • files_videoplayer: 1.1.0
  • firstrunwizard: 2.1
  • gallery: 17.0.0
  • groupfolders: 1.1.0
  • logreader: 2.0.0
  • lookup_server_connector: 1.0.0
  • nextcloud_announcements: 1.1
  • notes: 2.3.1
  • notifications: 2.0.0
  • oauth2: 1.0.5
  • password_policy: 1.2.2
  • provisioning_api: 1.2.0
  • serverinfo: 1.2.0
  • sharebymail: 1.2.0
  • survey_client: 1.0.0
  • systemtags: 1.2.0
  • theming: 1.3.0
  • twofactor_backupcodes: 1.1.1
  • updatenotification: 1.2.0
  • user_external: 0.4
  • workflowengine: 1.2.0

Disabled:

  • user_ldap

Nextcloud configuration:

The output of my config.php:

<?php
$CONFIG = array (
‘instanceid’ => ‘xxxx’,
‘passwordsalt’ => ‘xxxx’,
‘secret’ => ‘xxxx’,
‘trusted_domains’ =>
array (
0 => ‘xxxx’,
1 => ‘xxxx’,
),
‘datadirectory’ => ‘/nc_data’,
‘dbtype’ => ‘mysql’,
‘version’ => ‘12.0.2.0.’,
‘dbname’ => ‘nextcloud’,
‘dbhost’ => ‘localhost’,
‘dbtableprefix’ => ‘oc_’,
‘dbuser’ => ‘nextcloud’,
‘dbpassword’ => ‘nextcloud’,
‘mysql.utf8mb4’ => true,
‘htaccess.RewriteBase’ => ‘/’,
‘overwrite.cli.url’ => ‘/’,
‘overwriteprotocol’ => ‘https’,
‘loglevel’ => 2,
‘logtimezone’ => ‘Europe/Berlin’,
‘logfile’ => ‘/var/nc_data/nextcloud.log’,
‘log_rotate_size’ => 104857600,
‘cron_log’ => false,
‘installed’ => true,
‘filesystem_check_changes’ => 1,
‘quota_include_external_storage’ => false,
‘knowledgebaseenabled’ => false,
‘memcache.local’ => ‘\OC\Memcache\APCu’,
‘filelocking.enabled’ => ‘true’,
‘memcache.locking’ => ‘\OC\Memcache\Redis’,
‘redis’ =>
array (
‘host’ => ‘/var/run/redis/redis.sock’,
‘port’ => 0,
‘timeout’ => 0.0,
),
‘maintenance’ => false,
‘theme’ => ‘’,
‘integrity.check.disabled’ => false,
‘updater.release.channel’ => ‘stable’,
‘enable_previews’ => true,
‘mail_smtpmode’ => ‘smtp’,
‘mail_smtpauthtype’ => ‘LOGIN’,
‘mail_smtphost’ => ‘mail.xxx.xx’,
‘mail_smtpport’ => ‘xxxx’,
‘mail_smtpsecure’ => ‘ssl’,
‘mail_from_address’ => ‘xxxx’,
‘mail_domain’ => 'xxxx,
‘mail_smtpauth’ => 1,
‘mail_smtpname’ => ‘xxxx’,
‘mail_smtppassword’ => ‘xxxx’,
);

The output of my nginx error log in /var/log/nginx:

2017/09/06 00:21:40 [warn] 881#881: *50635 an upstream response is buffered to a temporary file /var/cache/nginx/fastcgi_temp/0/01/0000000010 while reading upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /remote.php/dav/files/user/FILE.mp3 HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock:”, host: “my_url.io”

2017/09/06 01:08:24 [error] 879#879: *52191 upstream timed out (110: Connection timed out) while reading response header from upstream, client: CLIENT-IP, server: my_url.io, request: “MOVE /remote.php/dav/uploads/userXY/3941241390/.file HTTP/1.1”, upstream: “http://127.0.0.1:82/remote.php/dav/uploads/userXY/3941241390/.file”, host: “my_url.io”

2017/09/06 01:12:46 [error] 878#878: *51474 upstream timed out (110: Connection timed out) while reading response header from upstream, client: CLIENT-IP, server: my_url.io, request: “MOVE /remote.php/dav/uploads/userXY/3409823176/.file HTTP/1.1”, upstream: “http://127.0.0.1:82/remote.php/dav/uploads/userXY/3409823176/.file”, host: “my_url.io”

2017/09/06 01:28:22 [error] 880#880: *53018 upstream timed out (110: Connection timed out) while reading response header from upstream, client: CLIENT-IP, server: my_url.io, request: “MOVE /remote.php/webdav/FILE.mp4 HTTP/2.0”, upstream: “http://127.0.0.1:82/remote.php/webdav/FILE.mp4”, host: “my_url.io”

2017/09/06 01:35:12 [error] 879#879: *53192 upstream timed out (110: Connection timed out) while reading response header from upstream, client: CLIENT-IP, server: my_url.io, request: “MOVE /remote.php/dav/uploads/userXY/1672020373/.file HTTP/1.1”, upstream: “http://127.0.0.1:82/remote.php/dav/uploads/userXY/1672020373/.file”, host: “my_url.io”

2017/09/06 01:55:46 [error] 879#879: *54854 upstream timed out (110: Connection timed out) while reading response header from upstream, client: CLIENT-IP, server: my_url.io, request: “MOVE /remote.php/dav/uploads/userXY/3616606520/.file HTTP/1.1”, upstream: “http://127.0.0.1:82/remote.php/dav/uploads/userXY/3616606520/.file”, host: “my_url.io”

2017/09/06 02:14:09 [error] 880#880: *55439 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock”, host: “my_url.io”

2017/09/06 02:14:09 [error] 880#880: *55443 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock”, host: “my_url.io”

2017/09/06 02:14:09 [error] 880#880: *55447 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock”, host: “my_url.io”

2017/09/06 02:18:32 [error] 878#878: *55464 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock”, host: “my_url.io”

2017/09/06 02:18:32 [error] 878#878: *55466 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock”, host: “my_url.io”

2017/09/06 02:18:32 [error] 878#878: *55473 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /status.php HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock”, host: “my_url.io”

2017/09/06 02:24:34 [error] 879#879: *55527 upstream timed out (110: Connection timed out) while reading response header from upstream, client: CLIENT-IP, server: my_url.io, request: “GET /apps/activity/ HTTP/2.0”, upstream: “http://127.0.0.1:82/apps/activity/”, host: “my_url.io”

2017/09/06 02:29:34 [error] 879#879: *55534 upstream timed out (110: Connection timed out) while reading response header from upstream, client: 127.0.0.1, server: 127.0.0.1, request: “GET /apps/activity/ HTTP/1.1”, upstream: “fastcgi://unix:/run/php/php7.1-fpm.sock”, host: “my_url.io”

SpontEIN avatar Sep 06 '17 11:09 SpontEIN