owncloud-archive / files_locking

3 stars 5 forks source link

Suspicious access, trying to lock /tmp/oc_tmp/... #15

Closed PVince81 closed 8 years ago

PVince81 commented 9 years ago

I was trying to test https://github.com/owncloud/core/pull/14704 when I uploaded images and opened an external storage that had images, then saw this: (cannot reproduce consistently)


{
  "reqId": "mXo9FYu6I9Zv7bIrErCc",
  "remoteAddr": "127.0.0.1",
  "app": "index",
  "message": "Exception: {\"Message\":\"Could not obtain lock type 1 on \\\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/data\\\/root\\\/files\\\/tmp\\\/oc_tmp_6200b126046bb9157e3eec9513a5eac9.JPG\\\".\",\"Code\":0,\"Trace\":\"#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps3\\\/files_locking\\\/lib\\\/lockingwrapper.php(44): OCA\\\\Files_Locking\\\\Lock->addLock(1, NULL)\\n#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps3\\\/files_locking\\\/lib\\\/lockingwrapper.php(80): OCA\\\\Files_Locking\\\\LockingWrapper->getLock('files\\\/tmp\\\/oc_tm...', 1)\\n#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(214): OCA\\\\Files_Locking\\\\LockingWrapper->file_get_contents('files\\\/tmp\\\/oc_tm...')\\n#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(958): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->file_get_contents('files\\\/tmp\\\/oc_tm...')\\n#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(432): OC\\\\Files\\\\View->basicOperation('file_get_conten...', '\\\/tmp\\\/oc_tmp_620...', Array)\\n#5 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/filesystem.php(645): OC\\\\Files\\\\View->file_get_contents('\\\/tmp\\\/oc_tmp_620...')\\n#6 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/image.php(545): OC\\\\Files\\\\Filesystem::file_get_contents('\\\/tmp\\\/oc_tmp_620...')\\n#7 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/preview\\\/image.php(43): OC_Image->loadFromFile('\\\/tmp\\\/oc_tmp_620...')\\n#8 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/preview.php(521): OC\\\\Preview\\\\Image->getThumbnail('\\\/sftp\\\/DSC_0158....', 36, 36, true, Object(OC\\\\Files\\\\View))\\n#9 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/preview.php(566): OC\\\\Preview->getPreview()\\n#10 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/core\\\/ajax\\\/preview.php(44): OC\\\\Preview->showPreview()\\n#11 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/route\\\/route.php(135) : runtime-created function(1): require_once('\\\/srv\\\/www\\\/htdocs...')\\n#12 [internal function]: __lambda_func(Array)\\n#13 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/route\\\/router.php(251): call_user_func('\\\\x00lambda_346', Array)\\n#14 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/base.php(787): OC\\\\Route\\\\Router->match('\\\/core\\\/preview.p...')\\n#15 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/index.php(36): OC::handleRequest()\\n#16 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps3\\\/files_locking\\\/lib\\\/lock.php\",\"Line\":246}",
  "level": 4,
  "time": "2015-03-16T16:42:23+00:00",
  "method": "GET",
  "url": "\/owncloud\/index.php\/core\/preview.png?file=%2Fsftp%2FDSC_0158.JPG&c=550707dfa7012&x=36&y=36&forceIcon=0"
}

Why would files_locking try and lock temporary files like "\/srv\/www\/htdocs\/owncloud\/data\/root\/files\/tmp\/oc_tmp_6200b126046bb9157e3eec9513a5eac9.JPG" ??

@icewind1991

DeepDiver1975 commented 9 years ago

The issue is within the preview code afaik as it passes the temp path to the view

DeepDiver1975 commented 9 years ago
\"Message\":\"Could not obtain lock type 1 on \\\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/data\\\/root\\\/files\\\/tmp\\\/oc_tmp_6200b126046bb9157e3eec9513a5eac9.JPG\\\".\",\"Code\":0,\"Trace\":\"
#0 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps3\\\/files_locking\\\/lib\\\/lockingwrapper.php(44): OCA\\\\Files_Locking\\\\Lock->addLock(1, NULL)\\n
#1 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps3\\\/files_locking\\\/lib\\\/lockingwrapper.php(80): OCA\\\\Files_Locking\\\\LockingWrapper->getLock('files\\\/tmp\\\/oc_tm...', 1)\\n
#2 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/storage\\\/wrapper\\\/wrapper.php(214): OCA\\\\Files_Locking\\\\LockingWrapper->file_get_contents('files\\\/tmp\\\/oc_tm...')\\n
#3 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(958): OC\\\\Files\\\\Storage\\\\Wrapper\\\\Wrapper->file_get_contents('files\\\/tmp\\\/oc_tm...')\\n
#4 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/view.php(432): OC\\\\Files\\\\View->basicOperation('file_get_conten...', '\\\/tmp\\\/oc_tmp_620...', Array)\\n
#5 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/files\\\/filesystem.php(645): OC\\\\Files\\\\View->file_get_contents('\\\/tmp\\\/oc_tmp_620...')\\n
#6 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/image.php(545): OC\\\\Files\\\\Filesystem::file_get_contents('\\\/tmp\\\/oc_tmp_620...')\\n
#7 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/preview\\\/image.php(43): OC_Image->loadFromFile('\\\/tmp\\\/oc_tmp_620...')\\n
#8 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/preview.php(521): OC\\\\Preview\\\\Image->getThumbnail('\\\/sftp\\\/DSC_0158....', 36, 36, true, Object(OC\\\\Files\\\\View))\\n
#9 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/preview.php(566): OC\\\\Preview->getPreview()\\n
#10 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/core\\\/ajax\\\/preview.php(44): OC\\\\Preview->showPreview()\\n
#11 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/route\\\/route.php(135) : runtime-created function(1): require_once('\\\/srv\\\/www\\\/htdocs...')\\n
#12 [internal function]: __lambda_func(Array)\\n
#13 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/private\\\/route\\\/router.php(251): call_user_func('\\\\x00lambda_346', Array)\\n
#14 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/lib\\\/base.php(787): OC\\\\Route\\\\Router->match('\\\/core\\\/preview.p...')\\n
#15 \\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/index.php(36): OC::handleRequest()\\n
#16 {main}\",\"File\":\"\\\/srv\\\/www\\\/htdocs\\\/owncloud\\\/apps3\\\/files_locking\\\/lib\\\/lock.php\",\"Line\":246}",
DeepDiver1975 commented 9 years ago

@PVince81 @schiesbn I guess this code is no longer valid: https://github.com/owncloud/core/blob/master/lib/private/image.php#L571

ghost commented 9 years ago

@PVince81 @schiesbn @DeepDiver1975 I'm not sure what the next steps are

PVince81 commented 9 years ago

This is the old file locking app and it seems that it's locking everything under the sun.

My concern was mostly that it was locking too many things and could be stripped down. But since now the focus is on transactional locking, I'd either defer or close this.

PVince81 commented 9 years ago

Deferred to 8.2

PVince81 commented 8 years ago

goodbye files_locking app, closing as obsolete