Segmentation fault on current master with large number of files
Expected behaviour
owncloud-client runs without issue
Actual behaviour
segmentation fault after a couple of minutes
Steps to reproduce
- Have working owncloud setup with 150k+ files using 1.5.2 and 6.0.2
- Build latest master
- Run new binary and wait
Server configuration
Operating system: Ubuntu 13.10
Web server: Apache
Database: Postgres
PHP version: 5.5.3
ownCloud version: 6.0.2
Client configuration
Client version: Built from Git revision b5349b on Mar 5 2014, 13:38:10 using OCsync 0.91.5 and Qt 4.8.4
Operating system: Ubuntu 13.10
OS language: English
Installation path of client: /usr/loca/bin/owncloud
Logs
Follows same format as my logs detailed in #1364 with the addition of:
... < lots of INSTRUCTION_NONE > ..
03-05 14:12:12:900 _csync_merge_algorithm_visitor: INSTRUCTION_NONE dir: folder_name
03-05 14:12:12:901 _csync_merge_algorithm_visitor: INSTRUCTION_NONE file: file_name.jpg
03-05 14:12:12:901 csync_reconcile: Reconciliation for remote replica took 2.40 seconds visiting 151753 files.
03-05 14:12:12:904 Transaction Start "checkConnect"
03-05 14:12:12:904 Columns in the current journal: ("phash", "pathlen", "path", "inode", "uid", "gid", "mode", "modtime", "type", "md5", "fileid")
03-05 14:12:12:921 "folder_name/.htaccess" one ETag is empty, no blacklisting
03-05 14:12:13:511 N------N Network Limits changed!
03-05 14:12:13:603 void Mirall::PropagateDirectory::slotSubJobReady() 0 0
03-05 14:12:13:603 void Mirall::PropagateDirectory::slotSubJobReady() 0 0
03-05 14:12:13:603 void Mirall::PropagateDirectory::slotSubJobReady() 0 0
03-05 14:12:13:603 void Mirall::PropagateDirectory::slotSubJobReady() 0 0
03-05 14:12:13:603 void Mirall::PropagateDirectory::slotSubJobReady() 1 0
03-05 14:12:13:603 true 6 Mirall::PropagateDirectory(0x3a346a0)
... < lots more like this then the log stops > ...
One further detail, when the client starts it says "Syncing 0 of 0 (0B of 0B)" but I've also tried the master build connecting to another (small) OC account and it does not crash and this does not come up. Not sure if that is pertinent or not.
Couple more details...
If I checkout https://github.com/owncloud/mirall/commit/02bfb4f0054bf8be7cb9380697f6d2350ae365d3 (labelled as 1.5.2) there is no crash, all files sync and the following time is output into the log:
03-05 16:15:46:607 csync_update: Update detection for remote replica took 1506.90 seconds walking 151753 files.
However if I checkout https://github.com/owncloud/mirall/commit/417dbcc9ac8881bf31088a8ea7524c2aea2db40c (labelled as 1.6.0pre), there is a seg fault, nothing is synced and the following time is output into the log:
03-05 16:26:24:293 csync_update: Update detection for remote replica took 219.08 seconds walking 151788 files.
@dragotin I've narrowed the problem down further and crucially managed to find a commit where a) there is no seg fault and b) the performance increases are there.
Checking out https://github.com/owncloud/mirall/commit/c38c3ce6e273bef9eafa75e6aed54d1d7a078561 results in a seg fault, however checking out that commit's parent https://github.com/owncloud/mirall/commit/8267b9e590ec22af455a44833702fc13e2abe9a9 results in a system that works completely and also performs excellently:
03-05 17:16:06:167 csync_update: Update detection for remote replica took 139.65 seconds walking 151786 files.
This means the seg fault is coming from parent https://github.com/owncloud/mirall/commit/aa02ce2481e83eaf29220db678be8d120dca63aa, I've followed the commits as far back as https://github.com/owncloud/mirall/commit/f5e16540a117219d57df81d8857c5103b97d1a2d but the seg fault is still occurring.
Current master is expected to be very instable.
Well aware of that, hence the attempt to help problem solve
Yes, thanks for reporting.
Do you have a backtrace.
Could you run the client with valgrind ?
I used the command
valgrind --leak-check=yes --error-limit=no /usr/local/bin/owncloud --logfile ~/owncloud-client.log > ~/owncloud-valgrind.log 2>&1
and the resulting valgrind log can be found here https://gist.github.com/ItsNotWorking/d4573e7ed012eac49dc0. Would you like me to re-run with any other options?
That was with https://github.com/owncloud/mirall/commit/5e012366ab2548bc3167e22b6174cee09307aa14 btw
Thank you very much. Please re-run it with --undef-value-errors=no
did it crash while running valgrind as well?
It did yep. Re-running now.
New output: https://gist.github.com/ItsNotWorking/65ab01fbdd322a39b6f9
Is there a compile option for the client that might provide more info? It's been a long time since I've done any C programming and I can't quite remember how everything works.
Oh, it's a stack overflow. Too bad valgrind don't show the backtrace in a stack overflow.
Then you can use gdb.
just run gdb /usr/local/bin/owncloud
And from gdb run r --logfile ~/owncloud-client.log
Then , when it crashes, run bt to get the backtrace.
The backtrace should be really long and repeating itself. I'm interrested in the part that repeat itself.
Next up: https://gist.github.com/ItsNotWorking/8f74394264b7b216bb40
@ItsNotWorking do you want to update your git and check again?
Brilliant! No seg fault and now the remote replica is reporting
03-06 20:41:56:584 csync_update: Update detection for remote replica took 150.78 seconds walking 151913 files.
instead of 1500~ seconds with 1.5.2, so the average CPU is only about 7% with spikes to 100 every few mins as it should.
amazing work, thanks
Thanks for reporting the issue.
150 seconds is still quite a lot.
I believe most of it is actually because of the logging.