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

find_property method in parser.hpp - cache having duplicated entries #49

Closed
issaharnoam opened this issue Jun 20, 2018 · 9 comments
Closed
Assignees

Comments

@issaharnoam
Copy link
Contributor

row 179, parser.hpp
needto to following fix (move caching inside if statement)
otherwise it is occasionally duplicated
...

  • property_info propInfo(pBufferIndex_, currentPropInfo, propertyLength);
  • cache_property(pName, propInfo);

// The property was found, return it
if (name == pName) {

  • property_info propInfo(pBufferIndex_, currentPropInfo, propertyLength);

  • cache_property(pName, propInfo);

    return propInfo;
    }

@zacbrown
Copy link
Collaborator

Hi,

Could you please provide a proof of concept or a more detailed explanation of this issue? A debug dump with full symbols demonstrating the duplicated properties in the cache would be sufficient.

krabsetw is single-threaded per trace session. We don't guarantee a unique cache across trace sessions. I'm confused as to how we might end up in a scenario where we've already added something to the cache if there's only a single thread.

thanks,

Zac

@zacbrown zacbrown self-assigned this Jun 20, 2018
@swannman
Copy link
Member

This sounds like the same issue that @aydany has a pull request out for.

@zacbrown
Copy link
Collaborator

Ah that’s right. I’ll link it.

Could you ping them internally and see if they have bandwidth to address the PR?

If not, I might be able to carve some time out to add the tests since we have a second +1 for the issue.

@issaharnoam
Copy link
Contributor Author

issaharnoam commented Jun 21, 2018

After I run and tested the code, I see this fix may cause other problems (lastPropertyIndex_ is stored into member variable), the fix should be more wide... Sorry for misleading ...
There is a need for wider fix...

@issaharnoam
Copy link
Contributor Author

why std::deque<std::pair<const wchar_t *, property_info>> is used and not std::map? it could replace all the logic with find_property etc.. and make it much simplier?

@zacbrown
Copy link
Collaborator

@issaharnoam - I believe historically, it was an optimization based on the observation that for a small N (number of items), traversing the deque would actually be faster than using a Binary/Hash map.

As to the fix, I'm open to an alternative if you have one.

@swannman
Copy link
Member

@zacbrown I’ve pinged @aydany twice now with no reply.

@zacbrown
Copy link
Collaborator

Thanks! I’ll try to find some time then :).

@zacbrown
Copy link
Collaborator

Fixed in #41

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

3 participants