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

Itermittent NPE in remove #76

Closed
cpotter1 opened this issue May 29, 2018 · 4 comments
Closed

Itermittent NPE in remove #76

cpotter1 opened this issue May 29, 2018 · 4 comments
Assignees
Labels
Milestone

Comments

@cpotter1
Copy link

In DataService, on line 227, seeing this problem periodically.

java.lang.NullPointerException
at org.dizitart.no2.internals.DataService.remove(DataService.java:228)
at org.dizitart.no2.internals.NitriteService.remove(NitriteService.java:372)
at org.dizitart.no2.internals.DefaultNitriteCollection.remove(DefaultNitriteCollection.java:360)
at org.dizitart.no2.internals.DefaultNitriteCollection.remove(DefaultNitriteCollection.java:349)
at

Looks like you are not checking for null on "removed" before calling getRevision:
Document removed = underlyingMap.remove(nitriteId);
int rev = removed.getRevision();

@cpotter1
Copy link
Author

This is using 3.0.0

@anidotnet
Copy link
Contributor

Can you please give me a reproducible code? The region from where it is throwing is as follows:

for (Document document : cursor) {
    NitriteId nitriteId = document.getId();
    indexingService.removeIndexEntry(document, nitriteId);

    Document removed = underlyingMap.remove(nitriteId);
    int rev = removed.getRevision();  <<< NPE

It means that nitriteId is not there in the underlyingMap, but the nitriteId is obtained from a document iterating the cursor which is generated from the same underlyingMap.

So I am curious why is it happening. My initial assumption is, you are removing the document from a different thread and it is hitting a race condition. So If you could give me a reproducible code it would be better for me to dig down and take proper measure.

@anidotnet anidotnet self-assigned this May 30, 2018
@anidotnet anidotnet added the bug label May 30, 2018
@anidotnet anidotnet added this to the 3.0.1 milestone May 30, 2018
@cpotter1
Copy link
Author

cpotter1 commented May 30, 2018 via email

anidotnet added a commit that referenced this issue May 31, 2018
@anidotnet
Copy link
Contributor

@cpotter1 can you test the latest snapshot now? - 3.0.1-SNAPSHOT

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

No branches or pull requests

2 participants