owncloud / files_antivirus

:space_invader: virus scanner for ownCloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QA] The system becomes unresponsive when ClamAV service has stopped

martjanoff opened this issue · comments

Issue can be reproduced if to simulate ClamAV service stop.
Getting error 500 after login.

ClamAV log file:

Mon Apr 12 17:06:04 2021 -> Limits: PCREMaxFileSize limit set to 26214400.
Mon Apr 12 17:06:04 2021 -> Archive support enabled.
Mon Apr 12 17:06:04 2021 -> AlertExceedsMax heuristic detection disabled.
Mon Apr 12 17:06:04 2021 -> Heuristic alerts enabled.
Mon Apr 12 17:06:04 2021 -> Portable Executable support enabled.
Mon Apr 12 17:06:04 2021 -> ELF support enabled.
Mon Apr 12 17:06:04 2021 -> Mail files support enabled.
Mon Apr 12 17:06:04 2021 -> OLE2 support enabled.
Mon Apr 12 17:06:04 2021 -> PDF support enabled.
Mon Apr 12 17:06:04 2021 -> SWF support enabled.
Mon Apr 12 17:06:04 2021 -> HTML support enabled.
Mon Apr 12 17:06:04 2021 -> XMLDOCS support enabled.
Mon Apr 12 17:06:04 2021 -> HWP3 support enabled.
Mon Apr 12 17:06:04 2021 -> Self checking every 3600 seconds.
Mon Apr 12 17:06:04 2021 -> Listening daemon: PID: 29949
Mon Apr 12 17:06:04 2021 -> MaxQueue set to: 100
Fri Apr 16 10:12:05 2021 -> +++ Started at Fri Apr 16 10:12:05 2021
Fri Apr 16 10:12:05 2021 -> Received 0 file descriptor(s) from systemd.
Fri Apr 16 10:12:05 2021 -> clamd daemon 0.102.4 (OS: linux-gnu, ARCH: x86_64, CPU: x86_64)
Fri Apr 16 10:12:05 2021 -> Running as user clamav (UID 112, GID 119)
Fri Apr 16 10:12:05 2021 -> Log file size limited to 4294967295 bytes.
Fri Apr 16 10:12:05 2021 -> Reading databases from /var/lib/clamav

The owncloud log:

{"reqId":"YHlETkXRw6K3a7cUf1m4mQAAAAA","level":2,"time":"2021-04-16T08:01:18+00:00","remoteAddr":"2.247.255.25","user":"admin","app":"c
ore","method":"GET","url":"\/owncloud\/index.php\/settings\/undefined\/img\/notifications.svg","message":"icap has been disabled becaus
e the license is not valid"}
{"reqId":"YHlETkXRw6K3a7cUf1m4mQAAAAA","level":3,"time":"2021-04-16T08:01:18+00:00","remoteAddr":"2.247.255.25","user":"admin","app":"n
o app in context","method":"GET","url":"\/owncloud\/index.php\/settings\/undefined\/img\/notifications.svg","message":"No valid license
 found for icap scanner"}
{"reqId":"YHlETkXRw6K3a7cUf1m4mQAAAAA","level":3,"time":"2021-04-16T08:01:18+00:00","remoteAddr":"2.247.255.25","user":"admin","app":"i
ndex","method":"GET","url":"\/owncloud\/index.php\/settings\/undefined\/img\/notifications.svg","message":"Exception: {\"Exception\":\"
OCA\\\\Files_Antivirus\\\\Scanner\\\\InitException\",\"Message\":\"No valid license found for icap scanner\",\"Code\":0,\"Trace\":\"#0 
\\\/var\\\/www\\\/owncloud\\\/apps-external\\\/files_antivirus\\\/lib\\\/ScannerFactory.php(52): OCA\\\\Files_Antivirus\\\\ScannerFacto
ry->getScannerClass()\\n#1 \\\/var\\\/www\\\/owncloud\\\/apps-external\\\/files_antivirus\\\/lib\\\/AppInfo\\\/Application.php(86): OCA
\\\\Files_Antivirus\\\\ScannerFactory->__construct()\\n#2 \\\/var\\\/www\\\/owncloud\\\/lib\\\/composer\\\/pimple\\\/pimple\\\/src\\\/P
imple\\\/Container.php(118): OCA\\\\Files_Antivirus\\\\AppInfo\\\\Application->OCA\\\\Files_Antivirus\\\\AppInfo\\\\{closure}(*** sensi
tive parameters replaced ***)\\n#3 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/AppFramework\\\/Utility\\\/SimpleContainer.php(108):
 Pimple\\\\Container->offsetGet()\\n#4 \\\/var\\\/www\\\/owncloud\\\/apps-external\\\/files_antivirus\\\/lib\\\/AppInfo\\\/Application.
php(156): OC\\\\AppFramework\\\\Utility\\\\SimpleContainer->query()\\n#5 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Stora
ge\\\/StorageFactory.php(100): OCA\\\\Files_Antivirus\\\\AppInfo\\\\Application->OCA\\\\Files_Antivirus\\\\AppInfo\\\\{closure}(*** sen
sitive parameters replaced ***)\\n#6 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Mount\\\/MountPoint.php(101): OC\\\\Files
\\\\Storage\\\\StorageFactory->wrap()\\n#7 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/External\\\/ConfigAdapter.php(148):
 OC\\\\Files\\\\Mount\\\\MountPoint->__construct()\\n#8 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/Files\\\/Config\\\/MountProvide
rCollection.php(82): OC\\\\Files\\\\External\\\\ConfigAdapter->getMountsForUser()\\n#9 [internal function]: OC\\\\Files\\\\Config\\\\Mo
untProviderCollection->OC\\\\Files\\\\Config\\\\{closure}(*** sensitive parameters replaced ***)\\n#10 \\\/var\\\/www\\\/owncloud\\\/li
b\\\/private\\\/Files\\\/Config\\\/MountProviderCollection.php(83): array_map()\\n#11 \\\/var\\\/www\\\/owncloud\\\/lib\\\/private\\\/F
iles\\\/Filesystem.php(446): OC\\\\Files\\\\Config\\\\MountProviderCollection->getMountsForUser()\\n#12 \\\/var\\\/www\\\/owncloud\\\/l
ib\\\/private\\\/Files\\\/Filesystem.php(374): OC\\\\Files\\\\Filesystem::initMountPoints()\\n#13 \\\/var\\\/www\\\/owncloud\\\/lib\\\/
private\\\/legacy\\\/util.php(311): OC\\\\Files\\\\Filesystem::init()\\n#14 \\\/var\\\/www\\\/owncloud\\\/lib\\\/base.php(914): OC_Util
::setupFS()\\n#15 \\\/var\\\/www\\\/owncloud\\\/index.php(54): OC::handleRequest()\\n#16 {main}\",\"File\":\"\\\/var\\\/www\\\/owncloud
\\\/apps-external\\\/files_antivirus\\\/lib\\\/ScannerFactory.php\",\"Line\":81}"}
{"reqId":"YHlEThCJuYeCwph-xv1YAwAAAAE","level":2,"time":"2021-04-16T08:01:18+00:00","remoteAddr":"2.247.255.25","user":"admin","app":"c
ore","method":"GET","url":"\/owncloud\/index.php\/settings\/undefined\/img\/notifications.svg","message":"icap has been disabled becaus
e the license is not valid"}
{"reqId":"YHlEThCJuYeCwph-xv1YAwAAAAE","level":3,"time":"2021-04-16T08:01:18+00:00","remoteAddr":"2.247.255.25","user":"admin","app":"n
o app in context","method":"GET","url":"\/owncloud\/index.php\/settings\/undefined\/img\/notifications.svg","message":"No valid license
 found for icap scanner"}

Clipboard - April 14, 2021 10_47 AM

Expected behavior: the system should still work. Uploads should fail with "Virus Scanner unavailable" error message.

@VicDeo Could you take a look?

@martjanoff please share more detailed reproduction steps including

  • your files_antivirus version (or branch that was used to reproduce it)
  • output for occ config:list files_antivirus

OC version: master@7afc5d5bcec244af3d6ff4779382f1035d6c76c3

>occ status
  - installed: true
  - first_install_version: 10.3.0.0
  - version: 10.7.1.0
  - versionstring: 10.7.1 prealpha
  - edition: Community

files_antivirus version: master@d2ae79c639e0d0d48d58ca0a59078d575eb10083 with the following settings:

>occ config:list files_antivirus
{
    "apps": {
        "files_antivirus": {
            "autoprobe": "1",
            "av_mode": "socket",
            "enabled": "yes",
            "installed_version": "1.0.0",
            "types": "filesystem,dav"
        }
    }
}

clamd is stopped.
Login works.
Uploading works as expected either:
Screenshot_20210419_154042

So I guess I miss some crucial app settings to reproduce this issue.

message":"No valid license found for icap scanner"

It looks to me that you're using the icap app without a valid ownCloud license. Please try either upgrading your license key, or disabling the icap app via occ app:disable icap. If disabling the app, you might also need to adjust or remove related settings in your config (see https://github.com/owncloud/icap#general-configuration).

@JammingBen JFYI: there is no icap app any more.

Ahh okay, thanks for the info! The message still seems to be related to the app asking for a valid license...? I mean, the app is still out there, and probably installed in older OC instances?

seems to be the same with the issue i'm fixing in #426

  • an expired license or a missing license out of the grace period produces a hard crash of the whole instance

At least my logs and screenshot looks the same as in #419 (comment)

it's a different issue. ICAP mode is hanging when the daemon doesn't respond.
### reproduction steps
1. Open files_antivirus configuration page
2. Set mode to ICAP and port to any free port that is not bound to any sevice
3. Hit 'save' and watch the app saving config forever.

~### Expected ~
A sane socket connection timeout

Nope it was related to the missing sockets PHP extension at my dev instance.
#428 pushed

Moving into Needs info as reproduction steps have been not provided yet.

@jnweiger Can we unblock this? @VicDeo fixed some stuff.

Retested with 1.0.0-rc1

The reproducer steps with icap are

  • configure icap with docker run --rm --name c-icap -ti deepdiver/icap-clamav-service
  • test by uploading a jpeg and an eicar test.
  • docker kill c-icap
  • logout the user, re-login.

The reproducer steps without icap are

  • configure icap with camd running as a service, using the socket
  • test by uploading a jpeg and an eicar test.
  • /etc/init.d/clamav-daemon stop
  • logout the user, re-login.

Both situations now work well now: Login is possible. Upload attempts bring up an error message.

(I cannot tell for sure which of the two was Dima's scenario. that is why I test both.)