client icon indicating copy to clipboard operation
client copied to clipboard

Segmentation fault on current master with large number of files

Open ndjdev opened this issue 12 years ago • 17 comments

Expected behaviour

owncloud-client runs without issue

Actual behaviour

segmentation fault after a couple of minutes

Steps to reproduce

  1. Have working owncloud setup with 150k+ files using 1.5.2 and 6.0.2
  2. Build latest master
  3. 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 > ...

ndjdev avatar Mar 05 '14 14:03 ndjdev

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.

ndjdev avatar Mar 05 '14 15:03 ndjdev

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.

ndjdev avatar Mar 05 '14 17:03 ndjdev

@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.

ndjdev avatar Mar 05 '14 17:03 ndjdev

Current master is expected to be very instable.

ogoffart avatar Mar 06 '14 13:03 ogoffart

Well aware of that, hence the attempt to help problem solve

ndjdev avatar Mar 06 '14 13:03 ndjdev

Yes, thanks for reporting.

Do you have a backtrace. Could you run the client with valgrind ?

ogoffart avatar Mar 06 '14 14:03 ogoffart

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?

ndjdev avatar Mar 06 '14 15:03 ndjdev

That was with https://github.com/owncloud/mirall/commit/5e012366ab2548bc3167e22b6174cee09307aa14 btw

ndjdev avatar Mar 06 '14 15:03 ndjdev

Thank you very much. Please re-run it with --undef-value-errors=no

did it crash while running valgrind as well?

ogoffart avatar Mar 06 '14 15:03 ogoffart

It did yep. Re-running now.

ndjdev avatar Mar 06 '14 15:03 ndjdev

New output: https://gist.github.com/ItsNotWorking/65ab01fbdd322a39b6f9

ndjdev avatar Mar 06 '14 16:03 ndjdev

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.

ndjdev avatar Mar 06 '14 16:03 ndjdev

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.

ogoffart avatar Mar 06 '14 18:03 ogoffart

Next up: https://gist.github.com/ItsNotWorking/8f74394264b7b216bb40

ndjdev avatar Mar 06 '14 18:03 ndjdev

@ItsNotWorking do you want to update your git and check again?

guruz avatar Mar 06 '14 20:03 guruz

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

ndjdev avatar Mar 06 '14 21:03 ndjdev

Thanks for reporting the issue. 150 seconds is still quite a lot.
I believe most of it is actually because of the logging.

ogoffart avatar Mar 06 '14 22:03 ogoffart