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

calling LeshanServer::destroy() with queue mode disable generate an NPE #1374

Closed
jvermillard opened this issue Jan 2, 2023 · 2 comments · Fixed by #1375
Closed

calling LeshanServer::destroy() with queue mode disable generate an NPE #1374

jvermillard opened this issue Jan 2, 2023 · 2 comments · Fixed by #1375
Labels
bug Dysfunctionnal behavior server Impact LWM2M server

Comments

@jvermillard
Copy link
Contributor

jvermillard commented Jan 2, 2023

Version(s)

master @ 4527744

Which components

leshan-server-cf

Tested With

No response

What happened

java.lang.NullPointerException: Cannot invoke "org.eclipse.leshan.server.queue.PresenceServiceImpl.destroy()" because "this.presenceService" is null

How to reproduce

Disable queue mode using: builder.disableQueueModeSupport();
create the server and destroy it using using LeshanServer::destroy() method

If you look at:
https://github.com/eclipse/leshan/blob/master/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServer.java#L219
w ith set presence server to null when queuemode is disabled then there is an obvious bug there:

https://github.com/eclipse/leshan/blob/master/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServer.java#433

The presenseServer must be tested for null

Relevant Output

No response

@jvermillard jvermillard added the bug Dysfunctionnal behavior label Jan 2, 2023
@sbernard31 sbernard31 added the server Impact LWM2M server label Jan 4, 2023
@sbernard31
Copy link
Contributor

You point to same URL twice but I guess you mean this is obvious that there is a bug at :
https://github.com/eclipse/leshan/blob/master/leshan-server-cf/src/main/java/org/eclipse/leshan/server/californium/LeshanServer.java#L433

Good catch.

I will review your PR and see if we need same kind of fix for branch 1.x.

@sbernard31
Copy link
Contributor

The fix is integrated in master (#1375) and in 1.x branch (c1123be)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Dysfunctionnal behavior server Impact LWM2M server
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants