-
Notifications
You must be signed in to change notification settings - Fork 812
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reduce excessive info logging #5780
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the contribution
please see my comments
unfortunately it would be very hard to analyze synchronization issues without the "Processing" log lines
I think the other one are good candidate to move to debug level
src/libsync/discovery.cpp
Outdated
qCDebug(lcDisco).nospace() << "Processing " << path._original | ||
<< " | (db/local/remote)" | ||
<< " | valid: " << dbEntry.isValid() << "/" << hasLocal << "/" << hasServer | ||
<< " | mtime: " << dbEntry._modtime << "/" << localEntry.modtime << "/" << serverEntry.modtime | ||
<< " | size: " << dbEntry._fileSize << "/" << localEntry.size << "/" << serverEntry.size | ||
<< " | etag: " << dbEntry._etag << "//" << serverEntry.etag | ||
<< " | checksum: " << dbEntry._checksumHeader << "//" << serverEntry.checksumHeader | ||
<< " | perm: " << dbEntry._remotePerm << "//" << serverEntry.remotePerm | ||
<< " | fileid: " << dbEntry._fileId << "//" << serverEntry.fileId | ||
<< " | inode: " << dbEntry._inode << "/" << localEntry.inode << "/" | ||
<< " | type: " << dbEntry._type << "/" << localEntry.type << "/" << (serverEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile) | ||
<< " | e2ee: " << dbEntry.isE2eEncrypted() << "/" << serverEntry.isE2eEncrypted() | ||
<< " | e2eeMangledName: " << dbEntry.e2eMangledName() << "/" << serverEntry.e2eMangledName | ||
<< " | file lock: " << localFileIsLocked << "//" << serverFileIsLocked; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rely heavily on this one to analyze any sync issue. So I would object the move from info level to debug level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree debugging often requires as many information as you can get..
- but this must not pollute log files during normal operation
- even in debugging case "useless" logging should be avoided
(if there is nothing to change maximum 1 log line telling "nothing to do on the file" is expected") - further improvement: ideally the "noting to do" log line exists not for each file but only once for each directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@isdnfan ideally I would like to be able to log those "Processing" log lines only when there is going to be a sync action by the client
currently we are not yet there
src/libsync/discovery.cpp
Outdated
@@ -1537,7 +1537,7 @@ void ProcessDirectoryJob::processFileFinalize( | |||
item->_direction = _dirItem->_direction; | |||
} | |||
|
|||
qCInfo(lcDisco) << "Discovered" << item->_file << item->_instruction << item->_direction << item->_type; | |||
qCDebug(lcDisco) << "Discovered" << item->_file << item->_instruction << item->_direction << item->_type; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same comment
@mgallien I don't doubt they're useful, but they're the issue. Having those log increases the log size by 3400% when running the client for five minutes. And that is without any file changes happening. It's too much for me to be able to use the client. /edit: |
there was a couple of change that made the situation worse. |
@thrimbor again, I am sorry to create extra work for you but could you rebase your work on the changes that were merged and see if you can resolve the conflicts ? |
Signed-off-by: Stefan Schmidt <[email protected]>
dea06db
to
58cb5bc
Compare
Sorry for the delay, it's rebased now. |
AppImage file: nextcloud-PR-5780-58cb5bcd27bb836aeeebd6bcfa076bebbb2f9c2a-x86_64.AppImage |
I tested the appimage above and confirm there is no more "processing" log entries. log archives are split into very small chunks (after a start on a small file set it created 4 .gz archives with 18.9kB total size). regarding the logging it looks promising. I see logs for changed files but no logs related to unchanged files. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see my comment
<< " | e2ee: " << dbEntry.isE2eEncrypted() << "/" << serverEntry.isE2eEncrypted() | ||
<< " | e2eeMangledName: " << dbEntry.e2eMangledName() << "/" << serverEntry.e2eMangledName | ||
<< " | file lock: " << localFileIsLocked << "//" << serverFileIsLocked; | ||
qCDebug(lcDisco).nospace() << "Processing " << path._original |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that change cannot get merged as it would basically make it impossible to analyze any sync issue without having affected users change their default log level and reproduce the issue
as far as I know, the main performance issue with logs is already solved and I am unconvinced we need this change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I disagree with you statement this PR makes sync troubleshooting impossible. the logs still contains file changes - which is exactly what I want to see during normal operations.
I'm system engineer with 20+ years of experience with different applications. reading logs is my daily job - I know what I want to find there. My view might be different then yours but in my opinion regular logs files should contain information related to application health and changes performed (high level). Adjusting log level is definitely an accepted approach in case of troubleshooting. The logs should rather remain small so one could keep them for long time.
In my eyes there are two major issues
- the size of the logs
- Writing multiple GBs of logs every 1-2 hours brakes SSDs which are limited in "data written" amount - look at the calculation in [Bug]: Nextcloud client generates >100 GB worth of log files every day (800MB per sync run). #5302. e.g. very common Samsung EVO860 has 150 TBW for 250 GB model. current desktop client kills such SSD in 3 years already!
- inefficient operations
- "touching" every file on the system on every sync cycle, even this only happens virtually costs CPU and burns energy. I don't really get why this is necessary.. Even you need this for some reason in my eyes there is no reason to logs this actions until you change something. In my scenario with 100k files there are ~300MB logs with 3.9.0 every single sync even with no changes.
- in general the approach to always "touch" every file is bad in term of resources. On my client with modern i7 CPU and SSD the regular 2h sync cycle (without changes) takes 1-2 minutes already (according to the logs) eating significant CPU and disk. Today when everybody is looking to save energy this is not a good habit.
I suggest
- short term this PR should be merged as soon as possible.
- long term more resource efficient sync algorithm should be implemented (e.g. only check all files on client start and rely on OS events for file changes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be feasible to make it an option (eg radio button near the logs section) that users can turn on or off if you need to analyse sync issues? |
Hello, Thank you for your contribution to the Desktop Client with this pull request. We truly value your support and hope to see more contributions from you in the future! Best regards, |
@Rello, are you really unable to be more specific about why it's "no longer relevant" or "outdated"? |
This is still very much relevant with existing issues (e.g., #3312, #5302, #3282, #5752, ...) |
nextcloud doesn't seem to be interested in fixing basic stuff anymore.. as long as they can't advertise some new features it seems to be irrelevant to them.. being a solid option isn't cool enough it seems. |
Hello, We value your feedback and will re-evaluate this topic 👍🏻 |
This cuts back logging from the worst offenders of #5302 - there might be more that appear when the client runs for a longer time, I mainly checked the ones that appeared after a few minutes of running the client.
#5752 might be a better solution, but I decided to submit a quick fix because I was frustrated that this critical issue (it causes significant SSD wear and potentially causes data loss by filling up the volume) didn't get enough attention in months.
Even after #5769 the client is unusable for me without these changes.
I think it's possible that this masks a deeper issue, a lot of the log messages referred to files that Nextcloud shouldn't even care about (i.e. files that are stored outside of any synced folders).