Skip to content

Browser shows "server fatal error" message when uploading a file with encryption and transactional locking enabled #17153

Closed

Description

@jnfrmarks

Steps to reproduce

  1. Install 8.1
  2. Enable transactional locking
  3. Navigate to the admin page and enable encryption
  4. Navigate to the apps page and enable default encryption module
  5. Go back to the admin page - see message to log out
  6. Log out and back in
  7. Upload a file

Expected behaviour

File should upload successfully

Actual behaviour

Browser shows "Internal Server Error" and the file is not listed. If you refresh the browser, the file is there.


{"reqId":"ERbVGHmnOakkKpuygSQS","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:36:45+00:00"}
{"reqId":"2h4Dvn\/8+yvyRv7e\/K8H","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:36:45+00:00"}
{"reqId":"qa1EjSZZWwO5Pif6fe5E","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:36:45+00:00"}
{"reqId":"aQJ7uWNUmDN1NTBlttAg","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:36:46+00:00"}
{"reqId":"5von09\/7j1LVlQLxB82O","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:37:43+00:00"}
{"reqId":"Vt2ZZdzJ1c+ICZMWJ07H","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:37:47+00:00"}
{"reqId":"233NiQmx3iDOlFSmbjAD","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:38:09+00:00"}
{"reqId":"K2tbffTgtiK66T8YblS4","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:38:12+00:00"}
{"reqId":"uxiVthIy2UNVtB2EP7V0","remoteAddr":"172.18.0.165","app":"PHP","message":"Module 'redis' already loaded at Unknown#0","level":3,"time":"2015-06-24T19:38:23+00:00"}
{"reqId":"NPQ1nxd6MmqaUKaCC7Xm","remoteAddr":"172.18.0.165","app":"PHP","message":"Call to a member function getPath() on a non-object at \/var\/www\/html\/owncloud\/lib\/private\/share\/share.php#132","level":3,"time":"2015-06-24T19:38:40+00:00"}
{"reqId":"PtUg9pZTUriKNNJOZkL6","remoteAddr":"172.18.0.165","app":"admin_audit","message":"Create \"\/at_admin\/files\/pre_136.txt\" by user at_admin, owner: at_admin","level":1,"time":"2015-06-24T19:40:36+00:00","method":"POST","url":"\/owncloud\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"PtUg9pZTUriKNNJOZkL6","remoteAddr":"172.18.0.165","app":"files_locking","message":"INFO: Write lock requested for \/var\/www\/html\/owncloud\/data\/at_admin\/files\/pre_136.txt","level":0,"time":"2015-06-24T19:40:36+00:00","method":"POST","url":"\/owncloud\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"PtUg9pZTUriKNNJOZkL6","remoteAddr":"172.18.0.165","app":"files_locking","message":"PASS: Write lock succeeded on \/var\/www\/html\/owncloud\/data\/at_admin\/files\/pre_136.txt","level":0,"time":"2015-06-24T19:40:36+00:00","method":"POST","url":"\/owncloud\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"PtUg9pZTUriKNNJOZkL6","remoteAddr":"172.18.0.165","app":"files_locking","message":"INFO: Incrementing lock type 2 count for \/var\/www\/html\/owncloud\/data\/at_admin\/files\/pre_136.txt","level":0,"time":"2015-06-24T19:40:36+00:00","method":"POST","url":"\/owncloud\/index.php\/apps\/files\/ajax\/upload.php"}
{"reqId":"PtUg9pZTUriKNNJOZkL6","remoteAddr":"172.18.0.165","app":"PHP","message":"Call to a member function getPath() on a non-object at \/var\/www\/html\/owncloud\/lib\/private\/share\/share.php#132","level":3,"time":"2015-06-24T19:40:36+00:00","method":"POST","url":"\/owncloud\/index.php\/apps\/files\/ajax\/upload.php"}


p364

Server Host info:

Ubuntu 14.04
PHP 5.5.9

Server configuration:

ownCloud Enterprise Edition 8.1 RC1 (daily) Build:2015-06-24T03:11:04+00:00 02b2b60

Activity

  1. added this to the milestone on Jun 24, 2015
  2. MorrisJobke commented on Jun 25, 2015

    @MorrisJobke
    Contributor
  3. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Please try again on master, there have been many fixes already since RC1.

    RC1 is already outdated.

  4. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Interestingly this message

    {"reqId":"PtUg9pZTUriKNNJOZkL6","remoteAddr":"172.18.0.165","app":"PHP","message":"Call to a member function getPath() on a non-object at \/var\/www\/html\/owncloud\/lib\/private\/share\/share.php#132","level":3,"time":"2015-06-24T19:40:36+00:00","method":"POST","url":"\/owncloud\/index.php\/apps\/files\/ajax\/upload.php"}
    

    looks like the error we see in #17029

  5. DeepDiver1975 commented on Jun 25, 2015

    @DeepDiver1975
    Contributor

    Please try again on master, there have been many fixes already since RC1.

    RC1 is already outdated.

    @jnfrmarks yes - please don't test transactional locking on outdated code base - please always use master - this piece is still under development

  6. jnfrmarks commented on Jun 25, 2015

    @jnfrmarks
    Author

    Isn't this build from June 24, 2015?

    ownCloud Enterprise Edition 8.1 RC1 (daily) Build:2015-06-24T03:11:04+00:00 02b2b60
    
    
  7. DeepDiver1975 commented on Jun 25, 2015

    @DeepDiver1975
    Contributor

    @jnfrmarks your are right - I got confused because of that RC1 tag - sorry for the noise

  8. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Same for me.

    But also I remember that upload with encryption worked for me before

  9. jnfrmarks commented on Jun 25, 2015

    @jnfrmarks
    Author

    @PVince81

    I also believe this worked earlier.

  10. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Confirmed happening on master (9be1d08).
    I followed the exact order of enabling locking, core encryption and the encryption module.

  11. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Strangely uploading from WebDAV works, but not Web UI.

    I'll compare the code paths.

  12. self-assigned this
    on Jun 25, 2015
  13. jnfrmarks commented on Jun 25, 2015

    @jnfrmarks
    Author

    @PVince81

    I believe that the upload is happening in the Web UI too. If you refresh your browser, you can see the file there.

  14. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Yes, seems web UI upload did go through.

    Maybe something at the end of the transfer triggered the error.

  15. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Code path for web UI error:

    0  OC\Share\Share::getUsersSharingFile() /srv/www/htdocs/owncloud/lib/private/share/share.php:132
    1  OCP\Share::getUsersSharingFile() /srv/www/htdocs/owncloud/lib/public/share.php:88
    2  OC\Encryption\File->getAccessList() /srv/www/htdocs/owncloud/lib/private/encryption/file.php:57
    3  OC\Files\Stream\Encryption->stream_open() /srv/www/htdocs/owncloud/lib/private/files/stream/encryption.php:246
    4  fopen()         /srv/www/htdocs/owncloud/lib/private/files/stream/encryption.php:187
    5  OC\Files\Stream\Encryption::wrapSource() /srv/www/htdocs/owncloud/lib/private/files/stream/encryption.php:187
    6  OC\Files\Stream\Encryption::wrap() /srv/www/htdocs/owncloud/lib/private/files/stream/encryption.php:169
    7  OC\Files\Storage\Wrapper\Encryption->fopen() /srv/www/htdocs/owncloud/lib/private/files/storage/wrapper/encryption.php:412
    8  OC\Files\Storage\Wrapper\Wrapper->fopen() /srv/www/htdocs/owncloud/lib/private/files/storage/wrapper/wrapper.php:285
    9  OC\Files\View->file_put_contents() /srv/www/htdocs/owncloud/lib/private/files/view.php:554
    10 OC\Files\View->fromTmpFile() /srv/www/htdocs/owncloud/lib/private/files/view.php:896
    11 OC\Files\Filesystem::fromTmpFile() /srv/www/htdocs/owncloud/lib/private/files/filesystem.php:735
    12 require_once()  /srv/www/htdocs/owncloud/apps/files/ajax/upload.php:195
    13 __lambda_func() /srv/www/htdocs/owncloud/lib/private/route/route.php%28153%29%20:%20runtime-created%20function:1
    14 call_user_func:{/srv/www/htdocs/owncloud/lib/private/route/router.php:274}() /srv/www/htdocs/owncloud/lib/private/route/router.php:274
    15 OC\Route\Router->match() /srv/www/htdocs/owncloud/lib/private/route/router.php:274
    16 OC::handleRequest() /srv/www/htdocs/owncloud/lib/base.php:867
    17 {main}          /srv/www/htdocs/owncloud/index.php:40
    

    The uploaded file is empty. This is because fopen succeeded, it created a file, but the error happens before the content is written.
    This is the same issue as #17029

    Closing as duplicate.

    I will still investigate why WebDAV isn't reaching that code path at all, this sounds suspicious.

  16. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    WebDAV works because it uses part files, explanation here: #17029 (comment)

    Web UI doesn't use part files (#12353 will improve that)

  17. PVince81 commented on Jun 25, 2015

    @PVince81
    Contributor

    Note: regarding the "used to work" statement.
    Yes, it used to worked before we introduced scanner locking, which now also acquires a shared lock whenever file info is retrieved.

  18. jnfrmarks commented on Jun 25, 2015

    @jnfrmarks
    Author

    @PVince81

    Could this error prevent the file from being scanned by the antivirus scanner?

  19. PVince81 commented on Jun 26, 2015

    @PVince81
    Contributor

    It depends at what point of the process the antivirus hooks itself in.

    From looking at the code here https://github.com/owncloud/files_antivirus/blob/master/appinfo/application.php#L99 it looks like it's using a storage wrapper. And here https://github.com/owncloud/files_antivirus/blob/master/lib/avirwrapper.php I can see that the wrapper is operating directly on the storage instance, so it should work.

    To clarify, the locking is always done on View level. The Storage is one level below the view, the View always calls the Storage matching the mount point to do operations.

    Still, this is something that needs to be tested.

    Another point: as far as I remember the antivirus also has a background scan that is triggered by cron. It could happen that a file cannot be scanned if that file is currently locked with an exclusive lock because it is currently being written. That should be ok, the antivirus would rescan it later (assuming that it is able to skip such errors).

    @VicDeo please confirm

  20. locked as resolved and limited conversation to collaborators on Aug 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions