Skip to content

OKAPI-1271: NPE TenantManager.jobRunPending .isExclusive - #1493

Open
julianladisch wants to merge 2 commits into
masterfrom
OKAPI-1271
Open

julianladisch wants to merge 2 commits into
masterfrom
OKAPI-1271

Conversation

@julianladisch

Copy link
Copy Markdown
Contributor

Okapi v7.0.14 failed when trying to install any module:

Cannot invoke "org.folio.okapi.bean.ModuleDescriptor.getSystemInterface(String)" because "md" is null
java.lang.NullPointerException: Cannot invoke "org.folio.okapi.bean.ModuleDescriptor.getSystemInterface(String)" because "md" is null
	at org.folio.okapi.managers.TenantManager.isExclusive(TenantManager.java:1055)
	at org.folio.okapi.managers.TenantManager.jobRunPending(TenantManager.java:1084)
	at org.folio.okapi.managers.TenantManager.lambda$jobInvoke$67(TenantManager.java:1118)
	at io.vertx.core.Future.future(Future.java:224)
	at org.folio.okapi.managers.TenantManager.jobInvoke(TenantManager.java:1118)
	at org.folio.okapi.managers.TenantManager.lambda$runJob$60(TenantManager.java:1011)
	at io.vertx.core.impl.future.Composition.complete(Composition.java:40)

Restarting Okapi worked around the issue.

The solution is to test for null to avoid the NullPointerException.

Okapi v7.0.14 failed when trying to install any module:
```
Cannot invoke "org.folio.okapi.bean.ModuleDescriptor.getSystemInterface(String)" because "md" is null
java.lang.NullPointerException: Cannot invoke "org.folio.okapi.bean.ModuleDescriptor.getSystemInterface(String)" because "md" is null
	at org.folio.okapi.managers.TenantManager.isExclusive(TenantManager.java:1055)
	at org.folio.okapi.managers.TenantManager.jobRunPending(TenantManager.java:1084)
	at org.folio.okapi.managers.TenantManager.lambda$jobInvoke$67(TenantManager.java:1118)
	at io.vertx.core.Future.future(Future.java:224)
	at org.folio.okapi.managers.TenantManager.jobInvoke(TenantManager.java:1118)
	at org.folio.okapi.managers.TenantManager.lambda$runJob$60(TenantManager.java:1011)
	at io.vertx.core.impl.future.Composition.complete(Composition.java:40)
```

Restarting Okapi worked around the issue.

The solution is to test for null to avoid the NullPointerException.
@sonarqubecloud

Copy link
Copy Markdown

@adamdickmeiss adamdickmeiss left a comment •

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.

tm.setMessage is not just informative. It allows the promise to eventually complete in the loop in line 1112-

if (md == null) {
logger.info("jobRunPending skips TenantModuleDescriptor id={} "
+ "because ModuleDescriptor is null", tm.getId());
continue;

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.

Suggested change
continue;
tm.setMessage("skipped because ModuleDescriptor is null");
continue;

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