Closed floorish closed 8 years ago
Any idea how I can debug what's going wrong on the user's Macs?
Sure! Here are some ideas of things you could check, either via additional logging, or getting your user to perform commands in their Terminal:
Thanks for the suggestions.
default.realm
files from the user (zipped & emailed)I'll check the permissions, but if they're incorrect (no read or write access) Realm would throw RLMError.FilePermissionDenied
instead of RLMError.FileAccess
right? At least it gives a different error for me if I test that locally.
Permissions look fine to me:
ls -al@ ~/Library/Containers/appname/Data/Library/Application\ Support/
drwx------ 13 username staff 442 Jun 4 11:17 .
drwx------ 29 username staff 986 Jun 4 09:23 ..
-rw-r--r--@ 1 username staff 12288 May 9 15:51 default.realm
com.apple.quarantine 23
-rw-r--r--@ 1 username staff 1464 May 9 15:50 default.realm.lock
com.apple.quarantine 23
-rw-r--r--@ 1 username staff 168 May 11 11:54 default.realm.log
com.apple.quarantine 23
-rw-r--r--@ 1 username staff 4096 May 9 15:51 default.realm.log_a
com.apple.quarantine 23
-rw-r--r--@ 1 username staff 4096 May 9 15:50 default.realm.log_b
com.apple.quarantine 23
prw------- 1 root staff 0 May 30 16:49 default.realm.note
I don't know what else could be happening here, or how to help you further.
@bdash brought up that using a tool like fs_usage
might be helpful in logging file system events to determine which operations are failing. I'm not sure how well fs_usage
handles mmapped files, but it's worth a shot.
Of course, this would only be useful if you can run this on a machine that can reproduce the problem, so this is dependent on your user being comfortable enough to run such a tool while the problem occurs.
prw------- 1 root staff 0 May 30 16:49 default.realm.note
That file being owned by root seems like it would be the cause of the problem. If we're unable to open the FIFO I believe we'll throw an error of type RLMErrorFileAccess
.
As to how it came to be owned by root… all I can say is that's not something Realm can do unless your app was launched as root.
Thanks for the help @jpsim & @bdash
I don't know how I missed that file being owned by root... It seems to be the obvious problem (of course I tried chown
-ing the default.realm
and default.realm.lock
files but not the .note
:/ )
No clue how that happened either, the app should not be launched as root (not sure if that's even possible). Thanks again!
Goals
Use/init the realm database on OSX
Expected Results
Realm instance is created
Actual Results
Realm throws an error:
NSFilePath=/Users/**/Library/Containers/**/Data/Library/Application Support/default.realm, NSLocalizedDescription=Permission denied, Error Code=2
This looks to be a
RLMError.FileAccess
file I/O errorSteps to Reproduce
Some users of my app consistently get the above error, but I cannot reproduce this locally. The usual reboot Mac/reinstall app did not solve the issue. I have received the realm files from a user with this problem and tried to load them myself, but they work fine on my machine (same OS/Realm versions etc.). The user has used the app before and it worked fine, I'm not sure since when exactly the app couldn't load the files anymore. Any idea how I can debug what's going wrong on the user's Macs?
Code Sample
Version of Realm and Tooling
Realm version: 0.98.6
Xcode version: 7.3
iOS/OSX version: 10.10.4 / 10.10.5 (Have not got any reports on 10.11 so far)
Dependency manager + version: Carthage 0.15.2