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

publish2Subscribers(payload, topic, qos); catch Exception java.lang.NullPointerException: null #820

Open
Tong-07 opened this issue Feb 19, 2024 · 3 comments

Comments

@Tong-07
Copy link

Tong-07 commented Feb 19, 2024

According to log tracking, after running for a period of time, it cannot be repeated. When pushing messages, it appears in publish2Subscribers(payload, topic, qos);
Method, can capture the broker will be Java. Lang. NullPointerException: null, but there is no stack information, and the MQTT client connection is not connect

public void internalPublish(MqttPublishMessage msg) {
    final MqttQoS qos = msg.fixedHeader().qosLevel();
    final Topic topic = new Topic(msg.variableHeader().topicName());
    final ByteBuf payload = msg.payload();
    LOG.info("Sending internal PUBLISH message Topic={}, qos={}", topic, qos);

    publish2Subscribers(payload, topic, qos);
    LOG.info("publish2Subscribers internal PUBLISH message Topic={}, qos={}", topic, qos);
    if (!msg.fixedHeader().isRetain()) {
        return;
    }
    if (qos == AT_MOST_ONCE || msg.payload().readableBytes() == 0) {
        // QoS == 0 && retain => clean old retained
        retainedRepository.cleanRetained(topic);
        return;
    }
    retainedRepository.retain(topic, msg);
}
@andsel
Copy link
Collaborator

andsel commented Mar 24, 2024

Hi @Tong-07 thank's for reporting this. Without a stack trace or a debug log it's impossible to understand where the NPE is triggered.

@Tong-07
Copy link
Author

Tong-07 commented Mar 25, 2024

publish2Subscribers(payload, topic, qos); NPE thrown out in this method, but there is no stack information, so I did not analyze the specific where, through the log, you can know is captured in a function

@Tong-07
Copy link
Author

Tong-07 commented Mar 25, 2024

Capture the information is a Java. Lang. NullPointerException: null

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

No branches or pull requests

2 participants