linkedin / linkedin/ambry

NPE in IndexSegment.find method

Open
#1,213 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.8k
Forks
298
Avg merge
21h 43m
Merged PRs (30d)
9

Description

Seen in production:

java.lang.NullPointerException 
com.github.ambry.store.IndexSegment.find - Line 341 (IndexSegment.java) 
com.github.ambry.store.PersistentIndex.findKey - Line 579 (PersistentIndex.java) 
com.github.ambry.store.PersistentIndex.findKey - Line 542 (PersistentIndex.java) 
com.github.ambry.store.PersistentIndex.findKey - Line 527 (PersistentIndex.java) 
com.github.ambry.store.PersistentIndex.findMissingKeys - Line 852 (PersistentIndex.java) 
com.github.ambry.store.BlobStore.findMissingKeys - Line 628 (BlobStore.java) 
com.github.ambry.replication.ReplicaThread.getMissingStoreKeys - Line 587 (ReplicaThread.java) 
com.github.ambry.replication.ReplicaThread.exchangeMetadata - Line 434 (ReplicaThread.java) 
com.github.ambry.replication.ReplicaThread.replicate - Line 340 (ReplicaThread.java) 
com.github.ambry.replication.ReplicaThread.run - Line 203 (ReplicaThread.java) 
java.lang.Thread.run - Line 748 (Thread.java)

Analysis: there is a small time window in map() method where sealed variable is set to true without holding the rwLock, where it is possible for another thread to sneak in and call the find method while sealing is in progress (in which case serEntries may be null).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in IndexSegment.java at find and map, focusing on the sealing path described in the report and the access from PersistentIndex.findKey. Trace the replication call chain through BlobStore and ReplicaThread, then verify that concurrent lookup during sealing no longer produces the reported NullPointerException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend, distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.