Skip to content
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

Flag is not returned correctly after updating user #19

Closed
argon opened this issue Dec 3, 2015 · 5 comments · Fixed by #20
Closed

Flag is not returned correctly after updating user #19

argon opened this issue Dec 3, 2015 · 5 comments · Fixed by #20
Assignees

Comments

@argon
Copy link

argon commented Dec 3, 2015

Version: 0.4.0-beta

Steps to reproduce:

  1. Configure a feature which has 0% rollout but enabled for a specific user
  2. Start LD client in anonymous mode
  3. Call toggle:<feature> default: false for the feature and observe it is disabled
  4. Later (after initial config sync) call updateUser with the feature-enabled-user
  5. Call toggle:<feature> default: false for the feature.

Expected:

  • The feature should be enabled

Actual:

  • The feature still returns disabled

Notes:

2015-12-03 19:49:18.715 dice[41049:2624458] Error saving to child context Error Domain=NSCocoaErrorDomain Code=134030 "(null)" UserInfo={NSAffectedObjectsErrorKey=(
    "<ConfigEntity: 0x7ff0e5dbef70> (entity: ConfigEntity; id: 0x7ff0e83ab1b0 <x-coredata:///ConfigEntity/t41C1F500-E578-416E-90FD-1AAF65F73B2259> ; data: {\n    featuresJsonDictionary = \"{\\n    \\\"feature-flag\\\" =     {\\n        value = 1;\\n    };\\n}\";\n    pollTimeInSeconds = 0;\n    user = nil;\n})"
), NSUnderlyingException=Cannot delete object that was never inserted.}, {
    NSAffectedObjectsErrorKey =     (
        "<ConfigEntity: 0x7ff0e5dbef70> (entity: ConfigEntity; id: 0x7ff0e83ab1b0 <x-coredata:///ConfigEntity/t41C1F500-E578-416E-90FD-1AAF65F73B2259> ; data: {\n    featuresJsonDictionary = \"{\\n    \\\"feature-flag\\\" =     {\\n        value = 1;\\n    };\\n}\";\n    pollTimeInSeconds = 0;\n    user = nil;\n})"
    );
    NSUnderlyingException = "Cannot delete object that was never inserted.";
}
2015-12-03 19:49:18.718 dice[41049:2612066] resuming config Polling
  • If, instead, the client is started with the user builder the flag is set correctly.
@cmavromoustakos
Copy link

@jeff-byrnesinnovation @jkodumal I know what the issue is. I will look and fix tonight.

Thank you @argon

@cmavromoustakos
Copy link

Fixed in pull #20

@argon
Copy link
Author

argon commented Dec 4, 2015

I tried the code in #20 and I am still seeing the same problem. Further investigation shows that after calling updateUser to go from Anonymous -> known user, user.config is still nil so no feature flags are found.

@cmavromoustakos
Copy link

@argon

I am seeing another coredata error related to events which is unrelated #21 .

I will look into the config flags not updating.

As far as the config values. Are you seeing them eventually update? I ran a quick smoke test swapping between :

User A -> Anonymous user -> User B -> User A

I was outputting the flags in the log and they seemed correct to me. Is your case when you start from an anonymous user? Any additional info you give will help me isolate the issue.

Thank you
Gus

@cmavromoustakos
Copy link

Ok I was able to reproduce the error (see attached log). Investigating now.

It appears that the first time we switch users the updated config from the server is not being set. On subsequent calls it is reading from the persisted config object in coredata which is returning the correct values

@argon can you confirm this is the issue you are seeing as well?

 2015-12-04 16:48:22.738 Shopnify[55149:597533] [Crashlytics] Version 3.4.1 (92)
 2015-12-04 16:48:28.706 Shopnify[55149:597533] Error is (null)
 2015-12-04 16:48:28.707 Shopnify[55149:597533] =================================
 2015-12-04 16:48:28.707 Shopnify[55149:597533] Config values for carrie-hartman
 2015-12-04 16:48:28.710 Shopnify[55149:597533] Value of test-mobile-flag in config is: 0
 2015-12-04 16:48:28.711 Shopnify[55149:597533] Value of user.isConnected in config is: 0
 2015-12-04 16:48:28.713 Shopnify[55149:597533] Value of metrics.collect.jdbc in config is: 0
 2015-12-04 16:48:28.714 Shopnify[55149:597533] Value of root-system in config is: 0
 2015-12-04 16:48:28.715 Shopnify[55149:597533] Value of cm-another-flag in config is: 0
 2015-12-04 16:48:28.717 Shopnify[55149:597533] Value of isConnected in config is: 0
 2015-12-04 16:48:28.717 Shopnify[55149:597533] =================================
 2015-12-04 16:52:38.790 Shopnify[55149:597533] Error is (null)
 2015-12-04 16:52:38.794 Shopnify[55149:597533] Error is (null)
 2015-12-04 16:52:38.795 Shopnify[55149:597533] =================================
 2015-12-04 16:52:38.795 Shopnify[55149:597533] Config values for carrie-hartman
 2015-12-04 16:52:38.797 Shopnify[55149:597533] Value of test-mobile-flag in config is: 1
 2015-12-04 16:52:38.799 Shopnify[55149:597533] Value of user.isConnected in config is: 0
 2015-12-04 16:52:38.800 Shopnify[55149:597533] Value of metrics.collect.jdbc in config is: 1
 2015-12-04 16:52:38.802 Shopnify[55149:597533] Value of root-system in config is: 0
 2015-12-04 16:52:38.803 Shopnify[55149:597533] Value of cm-another-flag in config is: 1
 2015-12-04 16:52:38.805 Shopnify[55149:597533] Value of isConnected in config is: 0
 2015-12-04 16:52:38.805 Shopnify[55149:597533] =================================
 2015-12-04 16:53:17.041 Shopnify[55149:597533] Error is (null)
 2015-12-04 16:53:17.042 Shopnify[55149:597533] =================================
 2015-12-04 16:53:17.043 Shopnify[55149:597533] Config values for anonymous
 2015-12-04 16:53:17.044 Shopnify[55149:597533] Value of test-mobile-flag in config is: 0
 2015-12-04 16:53:17.045 Shopnify[55149:597533] Value of user.isConnected in config is: 0
 2015-12-04 16:53:17.047 Shopnify[55149:597533] Value of metrics.collect.jdbc in config is: 0
 2015-12-04 16:53:17.048 Shopnify[55149:597533] Value of root-system in config is: 0
 2015-12-04 16:53:17.049 Shopnify[55149:597533] Value of cm-another-flag in config is: 0
 2015-12-04 16:53:17.050 Shopnify[55149:597533] Value of isConnected in config is: 0
 2015-12-04 16:53:17.051 Shopnify[55149:597533] =================================
 2015-12-04 16:53:27.401 Shopnify[55149:597533] Error is (null)
 2015-12-04 16:53:27.402 Shopnify[55149:597533] =================================
 2015-12-04 16:53:27.403 Shopnify[55149:597533] Config values for glen-hayes
 2015-12-04 16:53:27.404 Shopnify[55149:597533] Value of test-mobile-flag in config is: 0
 2015-12-04 16:53:27.405 Shopnify[55149:597533] Value of user.isConnected in config is: 0
 2015-12-04 16:53:27.406 Shopnify[55149:597533] Value of metrics.collect.jdbc in config is: 0
 2015-12-04 16:53:27.407 Shopnify[55149:597533] Value of root-system in config is: 0
 2015-12-04 16:53:27.409 Shopnify[55149:597533] Value of cm-another-flag in config is: 0
2015-12-04 16:53:27.411 Shopnify[55149:597533] Value of isConnected in config is: 0
2015-12-04 16:53:27.412 Shopnify[55149:597533] =================================
2015-12-04 16:53:35.373 Shopnify[55149:597533] Error is (null)
2015-12-04 16:53:35.377 Shopnify[55149:597533] Error is (null)
2015-12-04 16:53:35.378 Shopnify[55149:597533] =================================
2015-12-04 16:53:35.378 Shopnify[55149:597533] Config values for glen-hayes
2015-12-04 16:53:35.380 Shopnify[55149:597533] Value of test-mobile-flag in config is: 1
2015-12-04 16:53:35.382 Shopnify[55149:597533] Value of user.isConnected in config is: 0
2015-12-04 16:53:35.384 Shopnify[55149:597533] Value of metrics.collect.jdbc in config is: 0
2015-12-04 16:53:35.386 Shopnify[55149:597533] Value of root-system in config is: 0
2015-12-04 16:53:35.387 Shopnify[55149:597533] Value of cm-another-flag in config is: 0
2015-12-04 16:53:35.389 Shopnify[55149:597533] Value of isConnected in config is: 0
2015-12-04 16:53:35.389 Shopnify[55149:597533] =================================
2015-12-04 16:54:37.452 Shopnify[55149:597533] Error is (null)
2015-12-04 16:54:37.458 Shopnify[55149:597533] Error is (null)
2015-12-04 16:54:37.459 Shopnify[55149:597533] =================================
2015-12-04 16:54:37.459 Shopnify[55149:597533] Config values for glen-hayes
2015-12-04 16:54:37.461 Shopnify[55149:597533] Value of test-mobile-flag in config is: 1
2015-12-04 16:54:37.462 Shopnify[55149:597533] Value of user.isConnected in config is: 0
2015-12-04 16:54:37.463 Shopnify[55149:597533] Value of metrics.collect.jdbc in config is: 0
2015-12-04 16:54:37.464 Shopnify[55149:597533] Value of root-system in config is: 0
2015-12-04 16:54:37.466 Shopnify[55149:597533] Value of cm-another-flag in config is: 0
2015-12-04 16:54:37.467 Shopnify[55149:597533] Value of isConnected in config is: 0
2015-12-04 16:54:37.467 Shopnify[55149:597533] =================================
2015-12-04 16:54:46.297 Shopnify[55149:597533] Error is (null)
2015-12-04 16:54:46.301 Shopnify[55149:597533] Error is (null)
2015-12-04 16:54:46.302 Shopnify[55149:597533] =================================
2015-12-04 16:54:46.303 Shopnify[55149:597533] Config values for anonymous
2015-12-04 16:54:46.304 Shopnify[55149:597533] Value of test-mobile-flag in config is: 1
2015-12-04 16:54:46.305 Shopnify[55149:597533] Value of user.isConnected in config is: 0
2015-12-04 16:54:46.306 Shopnify[55149:597533] Value of metrics.collect.jdbc in config is: 1
2015-12-04 16:54:46.308 Shopnify[55149:597533] Value of root-system in config is: 0
2015-12-04 16:54:46.309 Shopnify[55149:597533] Value of cm-another-flag in config is: 1
2015-12-04 16:54:46.310 Shopnify[55149:597533] Value of isConnected in config is: 0
2015-12-04 16:54:46.311 Shopnify[55149:597533] =================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants