core icon indicating copy to clipboard operation
core copied to clipboard

Log spammed by "File source not found for:" errors

Open Djinnistorm opened this issue 12 years ago • 18 comments

Hello, new to github so forgive me if I am doing this horribly wrong. Furthermore, I have found issues with a similar problem (such as issue #4733 ) that state that this issue was solved, but I can't seem to re-open a closed issue, so...here we are.

Background Info:

OS is CentOS 6.4 DB is sqlite php version is 5.4.23 update.php: {"installed":"true","version":"6.0.0.14","versionstring":"6.0.0a","edition":""} This was updated from a 5.0.14a

I am getting a log that is absolutely filled to the brim with the following:

{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:20+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:20+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:20+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:20+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:21+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:22+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:22+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:22+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:22+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-31T02:09:22+00:00"}

This folder is in a shared directory, so it has no specific entry in the oc_share table as far as I can tell. The file named in the messages does not exist, I'm guessing a user deleted it. The log messages always seem to come in these blocks of alternating 10. The lines slowly increment in time (ex: 18:32:12+00:00 going to 18:51:18+00:00 over ~8500 lines of logs) with sudden large jumps in the middle of blocks, like the following:

{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T12:29:31+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T12:29:31+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T12:29:31+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T12:29:31+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T18:32:12+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T18:32:12+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T18:32:12+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T18:32:12+00:00"}
{"app":"files_sharing","message":"File source not found for: \/Amber Charter School\/Phots 2nd Floor Comm Rm","level":3,"time":"2013-12-30T18:32:12+00:00"}

The first log for this particular file was on December 26th. By the 31st, over 290,000 lines of this had been entered into the log. Any ideas? Let me know if more info is needed (and maybe how to get said info, I'm a bit new to this). Thanks!

Djinnistorm avatar Jan 03 '14 20:01 Djinnistorm

@Djinnistorm these log entries are telling us/you, that a file or folder which has been shared got removed - can you confirm this? THX

@schiesbn we had pull requests for oc6 which should have fixed this - right? Not to sure ... THX

DeepDiver1975 avatar Jan 03 '14 22:01 DeepDiver1975

An Amber Charter School directory does exist, but I do not see the file in question, which I should (if it exists) since that directory is within a shared directory. I also tried using find . -name Comm in the data folder. This returned no results, so the file doesn't exist (unless I messed up somewhere).

Djinnistorm avatar Jan 03 '14 23:01 Djinnistorm

Same / similar problems here: #6608, owncloud/mirall#1317 --> always in shared folders

mcgege avatar Jan 05 '14 13:01 mcgege

@Djinnistorm are you using the encryption app ?

PVince81 avatar Jan 07 '14 15:01 PVince81

@PVince81 Yes, we are.

Djinnistorm avatar Jan 07 '14 16:01 Djinnistorm

I'm having the same Issue too,

Owncloud 6.0a Debian 6 PHP 5.4.23-1 encryption app disabled

I think it might have to do something with the Sync-Client. An Idea might be, that the Sync-Client tries to upload a certain file but he fails for some reason, but he still tells the Server that the file is uploaded. Then another client gets the message that he is supposed to download that file but he cant find it.

Another time i saw that message happening was when someone tried to create a folder in /shared via the Sync-Client but he had no permission to do so.

Maybe this can Help.

viasys avatar Jan 14 '14 08:01 viasys

@DeepDiver1975 Yes, we fixed this on several places until I couldn't reproduce it any more. But that's not a guarantee that we have found all cases where this could happen.

All the places where I fixed it used the same pattern:

  • an app listen to the delete hook
  • once a file was deleted the file wants to do some final operation, e.g. clean up the versions. Therefore it asks OC Filesystem about the real location of the file because it could be a shared file. The Sharing API can't resolve it because the file no longer exists and creates the error message.

My solution in this case:

I implemented a pre-delete and a post-delete hook. The pre-delete hook does all the OC Filesystem operation to get the needed information as long as the file exists and stores it in an array. The post-delete hook took this information from the array and uses this information for his operations once the file was deleted successfully.

This pattern makes it hard to find all places which could trigger this messages. Actually every app could trigger this errors if it doesn't take care not to call any file system operations once a file was deleted.

Everybody who still see this error messages, can you please post a list of your enabled apps?

schiessle avatar Jan 14 '14 10:01 schiessle

Maybe we should change this error message to a debug or Info message? Until now I only read about the error log spam problem but never about "real" problems triggered by it. Maybe we publish the message to aggressive? Opinions?

schiessle avatar Jan 14 '14 10:01 schiessle

@schiesbn I think I already stated this last time: I question the necessity of this message at all.

As soon as the code detects that there is a file shared which no longer exists -> delete that share and continue.

DeepDiver1975 avatar Jan 14 '14 11:01 DeepDiver1975

is a file shared which no longer exists

to be read as: the referenced database entry is no longer there - no check to the filesystem

DeepDiver1975 avatar Jan 14 '14 11:01 DeepDiver1975

As soon as the code detects that there is a file shared which no longer exists -> delete that share and continue.

We already delete all shares if a file gets deleted. The problem are the delete hooks. Apps listen to the hooks, then want to do some final stuff with the file or with some meta-data and ask the filesystem something like getOwner() or getFileInfo(), but if it is a post-delete hook the file no longer exists which triggers the error. This could also break the hook. So for debugging/developing purpose the message can be useful to tell you that what you are trying to do can't be done in a post-delete hook. But it probably doesn't qualify as a general error message.

I will create a pull request to change this error message to a debug message.

schiessle avatar Jan 14 '14 11:01 schiessle

I will create a pull request to change this error message to a debug message.

This will help to not pollute the log file but not heal the system - the entry in the share table remains. I see no reason in keeping that entry - why not do some house keeping and delete that invalid entry as soon as we detect it.

DeepDiver1975 avatar Jan 14 '14 12:01 DeepDiver1975

I see no reason in keeping that entry - why not do some house keeping and delete that invalid entry as soon as we detect it.

The entry gets deleted. If the file delete operation is finished the entry will be gone. If not than it is a bug in the Updater which should be fixed there.

The problem of this particular error message is that it get triggered during the delete operation where we are in a state where the file is already deleted, the share table is not yet cleaned-up and some app asks for the file. So the message is useful for the developer because he needs to know that for such operations he should use a pre-hook, not a post-hook. It can also be useful to detect a getSource() call with an invalid target. But it is more something for development/debugging and not for general usage.

TL;DR no need to clean-up the share table at this point, the updater already takes care of it. The message shouldn't be displayed that prominent but it is useful for developing/debugging that's why I would not remove it completely... PR on the way ;-)

schiessle avatar Jan 14 '14 12:01 schiessle

List of enabled apps: -Activity -Deleted files -Documents -First Run Wizard -Full Text Search -PDF Viewer -Share Files -Text Editor -Updater -Files move

viasys avatar Jan 14 '14 12:01 viasys

Ok, got the admin info, so here's the enabled apps: -Calendar -Contacts -Deleted Files -Encryption -First Run Wizard -Full Text Search -PDF Viewer -Share Files -Text Editor -Updater -Versions -Video Viewer -FluXX Compensator (Y)

Meanwhile, this is now happening to several other files, so the log is kind of unreadable.

Djinnistorm avatar Jan 22 '14 18:01 Djinnistorm

@schiesbn @DeepDiver1975 PR is merged and pushed to stable6. Close?

VicDeo avatar Feb 08 '14 12:02 VicDeo

@Djinnistorm @mcgege @viasys can you confirm that this issue is gone in 6.0.2 ?

PVince81 avatar Mar 10 '14 20:03 PVince81

Yes, im not seeing this message anymore.

viasys avatar Mar 11 '14 08:03 viasys