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

Rare should equal failure with dictionary comparison [Remastered]. #682

Open
lolgear opened this issue May 22, 2016 · 7 comments
Open

Rare should equal failure with dictionary comparison [Remastered]. #682

lolgear opened this issue May 22, 2016 · 7 comments

Comments

@lolgear
Copy link

lolgear commented May 22, 2016

Well, as I told before

dictionaries equal doesn't work well.

I would like to narrow down the area for inspection, but I could only give you a clue:

git: yourkarma/jwt
branch: master ( latest release, for example, 2.0.2 )
JWTSpec.m
describe encoding -> context claims set -> it decode claims set and verify it correctly.

steps to reproduce:

  1. download latest release.
  2. open JWT.xcworkspace
  3. cleanup everything.
  4. run tests.
  5. do 4 - 3 - 4 - 4 - 4 - 3 - 4 or whatever order you'd like.
  6. catch results as failure of example mentioned above.
@modocache
Copy link
Member

Thanks for the remastered version! 😁

So I guess the problem is still occurring? Is it possible to reduce your test case at all? That is, does a dictionary comparison fail stochastically when not using code from the JWT project?

I ask because Kiwi uses -[NSObject isEqual:] for its equality matcher -- there isn't any special code path when comparing NSDictionary. For two dictionaries to only sometimes not be equal, I'd be forced to suspect either:

  1. All Kiwi equality comparisons fail stochastically, or...
  2. ...Apple's -[NSDictionary isEqual:] sometimes returns different values.

I think the more likely explanation is that something in the JWTSpec_encoding_claims_set_decode_claims_set_and_verify_it_correctly test has a race condition, which causes the two dictionaries to not be equal sometimes.

Of course, it's possible there's some bug I'm overlooking in Kiwi. Reducing the test case would help find that, too!

@lolgear
Copy link
Author

lolgear commented Jun 4, 2016

@modocache hey, how could I isolate this test?
Is it possible to move it to single spec file?
I think no, because kiwi doesn't allow to run single test :(
Single test project as an option?

@modocache
Copy link
Member

Hey @lolgear! Yeah, I think a new Xcode project with just this test, and just the source code it's testing, will probably help isolate the problem better.

@lolgear
Copy link
Author

lolgear commented Jun 6, 2016

@modocache
check master branch:
https://github.com/lolgear/JWT
Inspection -> SherlockHolmes project. ( In spec you could find steps to reproduce issue )

@lolgear
Copy link
Author

lolgear commented Aug 11, 2016

@modocache any update?

@modocache
Copy link
Member

Not yet, sorry! Will try to find a spare minute during a weekend soon.

@modocache
Copy link
Member

Or if you have some spare time before I do, you could take a look at the Kiwi internals to try and figure it out!

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

No branches or pull requests

2 participants