Skip to content

Uploading larger video file: Hangs on "this item is in processing" #529

Closed

Description

@DecaTec

Describe the bug

When uploading a larger video file (MOV), the upload is finished. But the file cannot be accessed, because it hangs on the status "this item is in processing".

Steps to reproduce

  1. Upload lager file (I think it doesn't have to be a video). File size: ~190 MB
  2. Wait until upload finishes.

Expected behavior

The item should be processed and the file should be accessible trough the UI.

Actual behavior

The status hangs on "this item is in processing". File cannot be accessed (even after a longer time waiting).

Confusing for the user as no error message is shown and the file cannot be removed/deleted either.

Setup

"opencloud_full" (with ClamAV)

OpenCloud 2.0.0 undefined
OpenCloud Web UI 2.1.0

Details

Logs OpenCloud

{"level":"error","service":"antivirus","error":"write unix @->/tmp/clamd.sock: write: broken pipe","uploadid":"48a5f497-940b-429a-809c-e49318f64452","time":"2025-03-30T16:34:25Z","line":"github.com/opencloud-eu/opencloud/services/antivirus/pkg/service/service.go:246","message":"error scanning file"}

Logs ClamAV

WARNING: Sun Mar 30 16:31:47 2025 -> INSTREAM: Size limit reached, (requested: 1024, max: 202)
WARNING: Sun Mar 30 16:31:53 2025 -> INSTREAM: Size limit reached, (requested: 1024, max: 977)
WARNING: Sun Mar 30 16:32:03 2025 -> INSTREAM: Size limit reached, (requested: 1024, max: 202)
WARNING: Sun Mar 30 16:32:24 2025 -> INSTREAM: Size limit reached, (requested: 1024, max: 202)
WARNING: Sun Mar 30 16:33:04 2025 -> INSTREAM: Size limit reached, (requested: 1024, max: 298)
WARNING: Sun Mar 30 16:34:25 2025 -> INSTREAM: Size limit reached, (requested: 1024, max: 796)

Additional context

Seems to be a problem with ClamAV refusing to scan such a big file.

However, there are no config options in .env or clamav.yml raising limits.

Generally, the OpenCloud should not deny access to files which cannot be scanned by ClamAV. There should be an option to "unlock" or delete these files.

Activity

  1. criegerde commented on Mar 30, 2025

    @criegerde

    Increased e.g. to 512 MB in clamav.yaml

    clamav:
        image: clamav/clamav:${CLAMAV_DOCKER_TAG:-latest}
        # release notes: https://blog.clamav.net
        environment:
          CLAMD_CONF_MaxFileSize: 512M
          CLAMD_CONF_MaxScanSize: 512M
          CLAMD_CONF_StreamMaxLength: 512M
          CLAMD_CONF_PCREMaxFileSize: 512M
    

    Now uploading bigger files (e.g. 512M) works as expected.

  2. micbar commented on Mar 30, 2025

    @micbar
    Member

    This behavior is known in combination with clamav.

    There is a setting where you can set the limit on openCloud. https://github.com/opencloud-eu/opencloud/tree/main/services/antivirus#maximum-scan-size

  3. criegerde commented on Mar 31, 2025

    @criegerde

    It doesn't seem to have any effect when setting ANTIVIRUS_MAX_SCAN_SIZE in clamav.yml

    Image

  4. micbar commented on Mar 31, 2025

    @micbar
    Member

    It doesn't seem to have any effect when setting ANTIVIRUS_MAX_SCAN_SIZE in clamav.yml

    Image

    Yes. It needs to go into opencloud.yml

  5. criegerde commented on Mar 31, 2025

    @criegerde

    Unfortunately, it doesn't have any effect neither.
    If i set ANTIVIRUS_MAX_SCAN_SIZE: 512M to opencloud.yml the upload still fails.
    Could you please advise me (us) a bit more?

    Without the parameter the file can not be finally processed (remains transparent):

    Image

    Using the parameter:

    Image

  6. micbar commented on Mar 31, 2025

    @micbar
    Member

    @fschade can you help?

  7. DecaTec commented on Mar 31, 2025

    @DecaTec
    Author

    Thanks for you feedback!

    Even if this would be configurable, I think it most important that an uploaded file doesn't get "blocked" when something wents wrong in the "post uploading process".

    Because when this process never finishes, the file cannot be accesses, but also not deleted.

    The only way out now seems to SSH into server, identifying the file, and deleting it.

    So the user uploading a file which gets stuck in processing should:

    • get a clear notfication why the processing ccan't be finished.
    • get the the opportunity to at least delete the file.
  8. micbar commented on Mar 31, 2025

    @micbar
    Member

    Because when this process never finishes, the file cannot be accesses, but also not deleted.

    You can configure a background job to restart the postprocessing job. https://github.com/opencloud-eu/opencloud/blob/main/services/postprocessing/README.md

  9. fschade commented on Mar 31, 2025

    @fschade
    Member

    i need one moment more... linux/arm64/v8 in the manifest list entries: no match for platform in manifest: not found uff

  10. self-assigned this
    on Mar 31, 2025
  11. fschade commented on Mar 31, 2025

    @fschade
    Member

    @DecaTec first of all, thank you very much for your report! Before I try to address it, here's my test environment so we're starting from the same situation.

    Notes

    please review the configurations and change each path to your need, e.g. $HOME/Developer/fschade/opencloud/tmp/env/clamav/data/ becomes PATH_TO_YOUR_DATA_ROOT/data/

    Config

    .envrc

    # BASE
    export OC_LOG_LEVEL=error
    export OC_LOG_PRETTY=true
    export OC_LOG_COLOR=true
    export OC_INSECURE=true
    
    # DATA
    export OC_BASE_DATA_PATH=$HOME/Developer/fschade/opencloud/tmp/env/clamav/data/opencloud
    export OC_CONFIG_DIR=$HOME/Developer/fschade/opencloud/tmp/env/clamav/data/opencloud
    
    # PROXY
    export PROXY_ENABLE_BASIC_AUTH=true
    
    # IDM
    export IDM_CREATE_DEMO_USERS=true
    export IDM_ADMIN_PASSWORD=admin
    
    # POSTPROCESSING
    export POSTPROCESSING_STEPS=virusscan
    
    # ANTIVIRUS
    export ANTIVIRUS_CLAMAV_SOCKET=$HOME/Developer/fschade/opencloud/tmp/env/clamav/data/clamav/clamd.ctl
    export ANTIVIRUS_MAX_SCAN_SIZE=25MB
    
    # SERVICES
    export OC_ADD_RUN_SERVICES=antivirus

    clamd.conf

    LocalSocket /Users/fschade/Developer/fschade/opencloud/tmp/env/clamav/data/clamav/clamd.ctl
    FixStaleSocket true
    LocalSocketGroup staff
    LocalSocketMode 666
    # TemporaryDirectory is not set to its default /tmp here to make overriding
    # the default with environment variables TMPDIR/TMP/TEMP possible
    User fschade
    ScanMail true
    ScanArchive true
    ArchiveBlockEncrypted false
    MaxDirectoryRecursion 15
    FollowDirectorySymlinks false
    FollowFileSymlinks false
    ReadTimeout 180
    MaxThreads 12
    MaxConnectionQueueLength 15
    LogSyslog false
    LogRotate true
    LogFacility LOG_LOCAL6
    LogClean false
    LogVerbose false
    PreludeEnable no
    PreludeAnalyzerName ClamAV
    DatabaseDirectory /Users/fschade/Developer/fschade/opencloud/tmp/env/clamav/data/clamav/db
    OfficialDatabaseOnly false
    SelfCheck 3600
    Foreground false
    Debug false
    ScanPE true
    MaxEmbeddedPE 10M
    ScanOLE2 true
    ScanPDF true
    ScanHTML true
    MaxHTMLNormalize 10M
    MaxHTMLNoTags 2M
    MaxScriptNormalize 5M
    MaxZipTypeRcg 1M
    ScanSWF true
    ExitOnOOM false
    LeaveTemporaryFiles false
    AlgorithmicDetection true
    ScanELF true
    IdleTimeout 30
    CrossFilesystems true
    PhishingSignatures true
    PhishingScanURLs true
    PhishingAlwaysBlockSSLMismatch false
    PhishingAlwaysBlockCloak false
    PartitionIntersection false
    DetectPUA false
    ScanPartialMessages false
    HeuristicScanPrecedence false
    StructuredDataDetection false
    CommandReadTimeout 30
    SendBufTimeout 200
    MaxQueue 100
    ExtendedDetectionInfo true
    OLE2BlockMacros false
    AllowAllMatchScan true
    ForceToDisk false
    DisableCertCheck false
    DisableCache false
    MaxScanTime 120000
    MaxScanSize 100M
    MaxFileSize 25M
    MaxRecursion 16
    MaxFiles 10000
    MaxPartitions 50
    MaxIconsPE 100
    PCREMatchLimit 10000
    PCRERecMatchLimit 5000
    PCREMaxFileSize 25M
    ScanXMLDOCS true
    ScanHWP3 true
    MaxRecHWP3 16
    StreamMaxLength 25M
    LogFile /Users/fschade/Developer/fschade/opencloud/tmp/env/clamav/data/clamav/clamav.log
    LogTime true
    LogFileUnlock false
    LogFileMaxSize 0
    Bytecode true
    BytecodeSecurity TrustSigned
    BytecodeTimeout 60000
    OnAccessMaxFileSize 5M

    freshclam.conf

    DatabaseOwner clamav
    UpdateLogFile /Users/fschade/Developer/fschade/opencloud/tmp/env/clamav/data/clamav/freshclam.log
    LogVerbose false
    LogSyslog false
    LogFacility LOG_LOCAL6
    LogFileMaxSize 0
    LogRotate true
    LogTime true
    Foreground false
    Debug false
    MaxAttempts 5
    DatabaseDirectory /Users/fschade/Developer/fschade/opencloud/tmp/env/clamav/data/clamav/db
    DNSDatabaseInfo current.cvd.clamav.net
    ConnectTimeout 30
    ReceiveTimeout 0
    TestDatabases yes
    ScriptedUpdates yes
    CompressLocalDatabase no
    Bytecode true
    NotifyClamd /Users/fschade/Developer/fschade/opencloud/tmp/env/clamav/config/clamd.conf
    Checks 24
    # official mirrors db.local.clamav.net and database.clamav.net are rate limited...
    DatabaseMirror clamavdb.c3sl.ufpr.br

    Services

    # update clamavdb
    freshclam --config-file=$HOME/Developer/fschade/opencloud/tmp/env/clamav/config/freshclam.conf
    # start clamav, add --foreground to run it in foreground
    clamd --config-file=$HOME/Developer/fschade/opencloud/tmp/env/clamav/config/clamd.conf
    # init oc - pre build binary
    opencloud init
    # init oc - from source
    go run ./opencloud/cmd/opencloud/main.go init

    Test scenarios i tried

    i tested each of those files individually and mixed.

    Result

    All of my tests worked without problems, unfortunately I can't see how you set ANTIVIRUS_MAX_SCAN_SIZE, for example I used ANTIVIRUS_MAX_SCAN_SIZE=25MB for testing

    Regarding your ideas on how to better inform users about errors, I agree; it's not optimal this way. We decided to do this because virus scanning is a very sensitive topic and clearly belongs in the hands of an admin and needs to be well thought out.

    The assumption at the time was that the admin would have logging (and possibly alerting) and track precisely these occurrences and then adjust the configuration if necessary.

    Can you briefly walk us through what would be optimal for you?

    @tbsbdr is our usability expert; I'm sure we have potential for optimization here; perhaps he has other ideas.

  12. DecaTec commented on Mar 31, 2025

    @DecaTec
    Author

    Hello @fschade

    I'm using a docker compose setup.

    The only two things I've changed regarding antivir are in the .env:

    • START_ADDITIONAL_SERVICES="notifications,antivirus" (added ,antivirus)
    • CLAMAV=:clamav.yml (removed the #, so that line is not commented out)

    Did not modify the clamav.yml.

    I haven't set ANTIVIRUS_MAX_SCAN_SIZE at all. When I get this right, in a docker compose setup, everything should be configures by the .env (no direct modifications in the *.yml files and also no manual editing in the config files inside the containers).

  13. fschade commented on Mar 31, 2025

    @fschade
    Member

    good point, ill add that config option later, @micbar do you have a preference as to what size the default should be?

  14. DecaTec commented on Mar 31, 2025

    @DecaTec
    Author

    Maybe it would be a good idea to set a "global max. upload size", e.g. 10GB.

    Then the max file size scanned by ClamAV should be the same.

  15. fschade commented on Mar 31, 2025

    @fschade
    Member

    the clamav source sample conf contains the following

    # Files larger than this limit won't be scanned. Affects the input file itself
    # as well as files contained inside it (when the input file is an archive, a
    # document or some other kind of container).
    # Value of 0 disables the limit.
    # Note: disabling this limit or setting it too high may result in severe damage
    # to the system.
    # Technical design limitations prevent ClamAV from scanning files greater than
    # 2 GB at this time.
    # Default: 100M
    #MaxFileSize 400M
    

    the sample is from: https://www.clamav.net/downloads clamav-1.0.8.tar.gz

    I tend to set the default to 100M and to include an option in the docker example. I get why you want to have 10G... but the system is used by several hundred users at the same time, which means that such a high value quickly multiplies immeasurably

  16. DecaTec commented on Mar 31, 2025

    @DecaTec
    Author

    Maybe scanning file up to e.g. 100 MB instantly and scanning all other files step by step?

    Then it only should be clear for a user why the file is "locked" (e..g. showing detailed information on the tool tip).

  17. fschade commented on Apr 1, 2025

    @fschade
    Member

    wont work, at least not with such huge files like your example of 20GB, CAV has a build in limit too, im not sure but if i remember right its 4GB... even if the limit is disabled by setting 0 in the conf...

    i have some more ideas on that topic, I'm currently trying to figure out how we can make the limits more flexible

  18. fschade commented on Apr 8, 2025

    @fschade
    Member

    @DecaTec please check #559 and if you wanna stick to 2.0 #620

    If you think "scan the remaining bytes later" is essential or something that would really make sense, please submit a feature request.

    Thanks for your input.

    I'm closing the issue for now. If it doesn't solve your problem or doesn't resolve it, please reopen it and ping me.

  19. moved this from Qualification to Done in OpenCloud Team Boardon Apr 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions