Skip to content

MOSIP-44507#288

Open
dhanendra06 wants to merge 7 commits intomosip:release-1.3.xfrom
dhanendra06:MOSIP-054
Open

MOSIP-44507#288
dhanendra06 wants to merge 7 commits intomosip:release-1.3.xfrom
dhanendra06:MOSIP-054

Conversation

@dhanendra06
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 26, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • develop

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: df552248-ea79-4b6b-a788-e970a294ba89

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

dhanendra06 and others added 6 commits March 26, 2026 13:44
* Fixed the stream handling

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Updated the khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the logger

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* changed the khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* removed the logger

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Removed unused code

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Removed whitespace

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

---------

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>
…tting the packet (mosip#283)

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>
* MOSIP-44507 (mosip#282)

* Fixed the stream handling

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Updated the khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the logger

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* changed the khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* removed the logger

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Removed unused code

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Removed whitespace

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

---------

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* removed the thread synchornization and removed dupplicate call for getting the packet

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* MOSIP-44507

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the schema validation

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the /biometric endpoint issue taking longer time to respond

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the cache issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the cache issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the cache issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Added cache

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Added cache

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* removed cache

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* removed cache changes

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the loggers

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Added logger in decrypt method

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* modified ziputils

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* packetreaderservice

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed securitycontext issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Reverted packetreader service

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the /info endpoint

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed /info endpoint slowness issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the /info endpoint

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed packetreaderservice slowness issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed packetreaderservice slowness issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Reverted packetreaderservice

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Reverted packetreaderimpl changes

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the /info endpoint slowness issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the packetreaderimpl

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* increased the performance of /info endpoint

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* increased the performance of /info endpoint

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* increased the performance of /info endpoint

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* reverted packetreader service impl changes

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Added back packet reader impl changes

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Made audit to async

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* reverted packet reader service

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Added virtual thread to improve the performance

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the Audit log entry

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed packet reader service info call performancee

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed packet reader service info call performancee

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed test case

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the executor to pass securitycontext

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed pod failing issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Reverted the config

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the performance issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed performance issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the executor issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the stability issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the search filed repeated s3 calls

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* updated khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Reverted the khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fix the validate request endpoint

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the validate endpoint performance

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the object serialization issue

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Updated khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* reverted khazana version

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* removed the loggers

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

* Fixed the build failure and removed the logger

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>

---------

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>
Signed-off-by: Dhanendra Sahu <60607841+dhanendra06@users.noreply.github.com>
Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>
…#285)

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>
…#287)

Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>
Signed-off-by: Dhanendra Sahu <dhanendra.tech@gmail.com>
Signed-off-by: Ashok Kumar Sharma <ashok@mosip.io>
@Bean(name = "auditTaskExecutor")
public ExecutorService auditTaskExecutor() {
auditPool = Executors.newFixedThreadPool(auditPoolSize,
Thread.ofPlatform().name("audit-", 0).daemon(true).factory());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use the daemon threads because these threads get killed once the main thread is completed and JVM will not wait to finish these threads.

@Bean(name = "packetFetchExecutor")
public ExecutorService packetFetchExecutor() {
fetchPool = Executors.newFixedThreadPool(fetchPoolSize,
Thread.ofPlatform().name("pkt-fetch-", 0).daemon(true).factory());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not use the daemon threads because these threads get killed once the main thread is completed and JVM will not wait to finish these threads.

@Value("${packetmanager.fetch.concurrency.limit:35}")
private int fetchConcurrencyLimit;

private Semaphore fetchSemaphore;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to check on this because it can restrict the overall packet processing underload because we are using the same semaphore multiple places.


BIR cachedValue = cache.get(cacheKey, BIR.class);
if(cachedValue != null) {
byte[] cachedBytes = cache.get(cacheKey, byte[].class);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we have changed the caching logic. Previously we were caching the BIR not byte[] is being cached. We have two issues with this:

  1. It can break the existing caching in redis because now cache data got changed.
  2. We need to call CbeffValidator.getBIRFromXML(cachedBytes); during the cache hit which is unnecessary during the hot path.

// biometric file not present in idobject. Search in meta data.
Map<String, String> metadataMap = getMetaInfo(id, source, process);
// Use facade's cached getMetaInfo() to avoid redundant S3 calls under high load.
Map<String, String> metadataMap = packetReader.getMetaInfo(id, source, process, false);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this change is not required because in positive flow, we find the bioString and we may not get into this flow. Issue is:

  1. While using this method, we are using the cached data which can cause issue.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Same semaphore is used for concurrency control which may block the threads in peak load.

Comment on lines +258 to +262
// Faster than regex
if (str.length() >= 2 && str.charAt(0) == '"' &&
str.charAt(str.length() - 1) == '"') {
str = str.substring(1, str.length() - 1);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check this code is not equivalent to finalMap.putIfAbsent(key, value.toString().replaceAll("(^")|("$)", "")); Please check.

Comment on lines +208 to +216
Map<String, Object> objectMap = new HashMap<>();
for (String field : allFields) {
Object value = identityFields.get(field);
if (value == null) continue;
if (value instanceof String || value instanceof Number || value instanceof Boolean) {
objectMap.put(field, value);
} else {
objectMap.put(field, mapper.writeValueAsString(value));
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +93 to +95
// Fetch info once for source resolution; reuse across all fields
// to avoid N redundant S3 listObjectsV2 calls (one per field).
InfoResponseDto cachedInfo = packetReaderService.getInfoForSourceResolution(fieldDtos.getId());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this change because getSourceAndProcess() already calling packetReaderService.getInfoForSourceResolution(id); internally?

@ashok-ksharma
Copy link
Copy Markdown
Contributor

As packet manager is being used as library. We need to validate whether packet manager library in reg client is also working fine as we have done lot of changes.

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 this pull request may close these issues.

2 participants