OpenMediaVault-Plugin-Developers / openmediavault-webdav

webdav plugin for OpenMediaVault
22 stars 6 forks source link

webdav constantly creates lock files in /tmp #14

Closed zoeeer closed 2 years ago

zoeeer commented 5 years ago

I find that webdav is constantly creating /tmp/webdav#### files. Around 110~140 files are created a minute.

I checked the code /var/www/webdav, and it seems those are lock files created in the /tmp folder.

As to the frequency of creations, I don't think it's normal behavior. Is there anything I can do about this?

ryecoaaron commented 5 years ago

That seems to be more a function of your webdav client - http://sabre.io/dav/locks/

zoeeer commented 5 years ago

The creations are indeed related to client side operations, as I observed. But I still think it's creating way too many locks.

According to the code, bootstrap/server.php is loaded and executed each time index.php is visited. So it creates a new lock file each time a client makes a request, and never releases them?

bootstrap/server.php

// Set up WebDAV locks.
$lockBackend = new \Sabre\DAV\Locks\Backend\File(
    tempnam(sys_get_temp_dir(), 'webdav')
);
$lockPlugin = new \Sabre\DAV\Locks\Plugin($lockBackend);

// Add plugins.
$server->addPlugin($lockPlugin);

public/index.php:

<?php
$server = require_once __DIR__ . '/../bootstrap/server.php';
$server->exec();

For now, I made a cron job to remove lock files older than 24 hours.

zoeeer commented 5 years ago

Can I change server.php to use a single lock file in /tmp instead of creating random-named ones? But I'm not sure how the lock files are used.

ryecoaaron commented 5 years ago

No idea. I don't use webdav or sabre-dav. And since this is sabre-dav code, it really isn't the plugin either. I have been recommending people use webdav dockers instead of this plugin since I'm not going to maintain it anymore.

zoeeer commented 5 years ago

I've tried docker. Everything seems good except the user mapping between host and container. I prefer setting up using nginx directly if not using this plugin. Thanks anyway.

ryecoaaron commented 5 years ago

You can change the user id and group id mappings in a container.

zoeeer commented 5 years ago

great... I'll look into this later. Thanks!