GithubHelp home page GithubHelp logo

hivemq / hivemq-community-edition Goto Github PK

View Code? Open in Web Editor NEW
1.0K 64.0 261.0 12.48 MB

HiveMQ CE is a Java-based open source MQTT broker that fully supports MQTT 3.x and MQTT 5. It is the foundation of the HiveMQ Enterprise Connectivity and Messaging Platform

Home Page: https://www.hivemq.com

License: Apache License 2.0

Java 99.51% Batchfile 0.11% Shell 0.19% HTML 0.19%
mqtt-broker hivemq mqtt iot java messaging pubsub m2m iot-middleware broker

hivemq-community-edition's People

Contributors

a-imal avatar afalhambra-hivemq avatar busybeetree avatar cihanucar avatar dc2-danielkrueger avatar dobermai avatar donnerbart avatar fibrefox avatar florian-limpoeck avatar fraschbi avatar gitseti avatar hlohse avatar iskerrett avatar lbrandl avatar mario-schwede-hivemq avatar mchernyakov avatar michaelg9 avatar micwalter avatar pglombardo avatar remit avatar renovate[bot] avatar rhinobetatron avatar robinatherton avatar sauroter avatar sbaier1 avatar schaebo avatar sgtsilvio avatar tgracchus avatar yannickweber avatar ymengesha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hivemq-community-edition's Issues

Issue using TLS 1.3 Cipher Suites (Getting a SSL exception: closing inbound before receiving peer's close_notify)

I've configured the HiveMQ Community Edition server to use TLS. I am trying to use two TLS 1.3 cipher suites: TLS_AES_128_GCM_SHA256 and TLS_AES_256_GCM_SHA384 but it appears I'm consistently getting a javax.net.ssl.SSLException: closing inbound before receiving peer's close_notify. I've tried manually adding the ciphers I want to the config.xml but the server marks these an unknown in the console window. I generated the appropriate key pair added it to the Java trust store (the cacerts file) and I had tested using a TLS 1.2 cipher suite using RSA: TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (with a different certificate) and it worked without any issues. I suspect that HiveMQ is filtering out my cipher suite as I tried creating an SSL engine using and used .getEnabledCipherSuites() and .getSupportedCipherSuites() and it has the cipher suites above supported by my JVM and also the TLS 1.3 protocol. I'm leaving a link to the Stack Overflow post which explains everything in more detail and includes code and debugging information . I'm also leaving more details below.

Stack Overflow Post: https://stackoverflow.com/questions/56904682/how-to-properly-use-tls-1-3-cipher-suites-in-hivemq-getting-a-ssl-exception-c

  • Affected HiveMQ CE version(s): HiveMQ CE v2019.1 (HiveMQ Client: 1.1.0, haven't tried with earlier versions but it's likely an issue on the server side)
  • Used JVM version: Java 11.0.3, Java 12.0.1 (I tried both, originally Java 11.0.3 and then I upgraded to Java 12.0.1 and tried it again with no success)

I want to get the event information when the client subscribes to topic

Problem or use case

I want to get the event information when the client subscribing to the topic, and get the topic information that the client subscribing to for some processing.

But I don't know which HiveMQ Extension is more appropriate to use.

Preferred solution or suggestions

set wrong pluginClassLoader

in the method com.hivemq.extensions.handler.ClientLifecycleEventHandler#fireOnMqttConnect

final PluginInTaskContext taskContext = new ProviderInTaskContext(EventTask.class, connect.getClientIdentifier());
        final ConnectionStartInputImpl connectionStartInput = new ConnectionStartInputImpl(connect, ctx.channel());

        for (final Map.Entry<String, ClientLifecycleEventListenerProvider> eventListenerEntry : pluginEventListenerProviderMap.entrySet()) {
            final EventTask<ConnectionStartInputImpl> connectEventTask = new EventTask<>(eventListenerEntry.getValue(), providerInput, eventListenerEntry.getKey(), eventListeners);
            if (!pluginTaskExecutorService.handlePluginInTaskExecution(taskContext, connectionStartInput, connectEventTask)) {
                log.warn("Extension task queue full. Ignoring '{}' from extension '{}'", eventListenerEntry.getValue(), eventListenerEntry.getKey());
            } else {
                ctx.channel().attr(ChannelAttributes.PLUGIN_CONNECT_EVENT_SENT).setIfAbsent(true);
            }
        }

the result of taskContext.getPluginClassLoader() is AppClassLoader,and in method com.hivemq.extensions.executor.task.PluginTaskExecutor.PluginTaskExecutorRunnable#runTask

final Thread thread = Thread.currentThread();
            final ClassLoader contextClassLoader = thread.getContextClassLoader();
            try {
                thread.setContextClassLoader(task.getPluginContext().getPluginClassLoader());

                final PluginTask pluginTask = task.getPluginTask();
                final PluginTaskOutput output;
                if (pluginTask instanceof PluginInOutTask) {
                    output = runInOutTask(task, (PluginInOutTask) pluginTask);
                } else if (pluginTask instanceof PluginInTask) {
                    output = runInTask(task, (PluginInTask) pluginTask);
                } else if (pluginTask instanceof PluginOutTask) {
                    output = runOutTask(task, (PluginOutTask) pluginTask);
                } else {
                    throw new IllegalArgumentException("Unknown task type for extension task queue");
                }
                return output;
            } finally {
                thread.setContextClassLoader(contextClassLoader);
            }

the result of task.getPluginContext().getPluginClassLoader() is AppClassLoader too, I think it's not right, the thread context class loader should be the class loader which loads the plugin related with the pluginTask, am I right?

Configureable: AUTH_DENY_UNAUTHENTICATED_CONNECTIONS

Problem or use case

Maybe the problem belongs to the following issue: Notification if HiveMQ starts without Security Extension in CE #56

We are using HiveMQ CE in our Spring mircoservice environment. To secure the communication with the IoT platform, we developed an Authenticator and Authorizer Extension with Spring Boot, Spring Security und Spring Cloud.

HiveMQ CE Version: 2019.1
HiveMQ SDK Version: 4.0.0

Problem

  1. In some cases it's possible for devices to connect with the HiveMQ broker before the extension is ready or if it failed on start up. This can cause data loss in some cases, e. g. if the device connects and sends data with QoS 0.

Is there a way to configure the InternalConfigurations.AUTH_DENY_UNAUTHENTICATED_CONNECTIONS property?

  1. The HiveMQ doesn't shut down if the extension fails. Here we need to configure the environment to detect HiveMQ instances without running extensions.

Is there a way to prevent the start up if an extension fails? Is it planned to add a "mandatory" flag for extensions (like "disabled")?

Preferred solution or suggestions

  1. It would be great if the property, inside the HiveMQ CE implementation, InternalConfigurations.AUTH_DENY_UNAUTHENTICATED_CONNECTIONS is configureable via XML file.

  2. A "mandatory" flag for extensions and a shutdown of the HiveMQ broker if the mandatory extension fails.

Best regards,
Florian Freimann

Hivemq constantly restarts

Here is the trace log. Hivemq constantly restarts after ever few seconds.

2019-07-16 19:22:30,482 TRACE [hivemq-eventloop-child-3] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:30,496 TRACE [hivemq-eventloop-child-0] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:30,752 TRACE [hivemq-eventloop-child-1] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:30,917 TRACE [hivemq-eventloop-child-1] c.h.m.h.p.PingRequestHandler [PingRequestHandler.java:49] PingReq received for client test-client8.
2019-07-16 19:22:30,917 TRACE [hivemq-eventloop-child-1] c.h.m.h.p.PingRequestHandler [PingRequestHandler.java:53] PingResp sent for client test-client8.
2019-07-16 19:22:31,163 TRACE [hivemq-eventloop-child-3] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:31,253 TRACE [hivemq-eventloop-child-0] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:31,320 TRACE [hivemq-eventloop-child-1] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:31,395 TRACE [hivemq-eventloop-child-2] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:31,594 TRACE [hivemq-eventloop-child-3] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:31,963 TRACE [hivemq-eventloop-child-0] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:32,472 TRACE [hivemq-eventloop-child-2] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:33,066 TRACE [hivemq-eventloop-child-3] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:33,121 TRACE [hivemq-eventloop-child-1] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:33,933 TRACE [hivemq-eventloop-child-2] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client null disconnected ungracefully
2019-07-16 19:22:34,450 INFO [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:100] Shutting down HiveMQ. Please wait, this could take a while...
2019-07-16 19:22:34,451 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:101] Running synchronous shutdown hook
2019-07-16 19:22:34,464 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook Lifecycle Shutdown
2019-07-16 19:22:34,465 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook Global Traffic Shaper Executor Shutdown Hook
2019-07-16 19:22:34,465 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook Netty Shutdown
2019-07-16 19:22:34,465 DEBUG [shutdown-executor] c.h.b.NettyShutdownHook [NettyShutdownHook.java:61] Shutting down worker and boss threads
2019-07-16 19:22:34,466 TRACE [shutdown-executor] c.h.b.NettyShutdownHook [NettyShutdownHook.java:65] Waiting for Worker threads to finish
2019-07-16 19:22:34,466 TRACE [hivemq-eventloop-child-2] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client 697f6fd7-6b33-416d-b83b-bda6e68f26dc disconnected ungracefully
2019-07-16 19:22:34,466 TRACE [hivemq-eventloop-child-0] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client f0003e77-6c41-4fc7-9e0e-cf6886c2c1c1 disconnected ungracefully
2019-07-16 19:22:34,472 TRACE [hivemq-eventloop-child-2] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client 0ecf7cb0-926e-49b4-a82f-daff8f0ef9ee disconnected ungracefully
2019-07-16 19:22:34,472 TRACE [hivemq-eventloop-child-1] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client 12fbfbad-b5fc-40dc-ae84-72f4f2ec0364 disconnected ungracefully
2019-07-16 19:22:34,474 TRACE [hivemq-eventloop-child-1] c.h.m.h.d.DisconnectHandler [DisconnectHandler.java:111] Client test-client8 disconnected ungracefully
2019-07-16 19:22:34,500 TRACE [single-writer-0] c.h.m.s.InternalPublishServiceImpl [InternalPublishServiceImpl.java:99] Adding retained message on topic remote-diag/logs/96e3750a-3f48-486a-ae12-9cb5aeab068f
2019-07-16 19:22:34,502 TRACE [single-writer-3] c.h.p.l.x.RetainedMessageXodusLocalPersistence [RetainedMessageXodusLocalPersistence.java:249] Replacing retained message for topic remote-diag/logs/96e3750a-3f48-486a-ae12-9cb5aeab068f
2019-07-16 19:22:36,669 TRACE [shutdown-executor] c.h.b.NettyShutdownHook [NettyShutdownHook.java:67] Waiting for Boss threads to finish
2019-07-16 19:22:36,669 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook Extension System Shutdown Hook
2019-07-16 19:22:36,669 INFO [shutdown-executor] c.h.e.PluginBootstrapImpl$PluginSystemShutdownHook [PluginBootstrapImpl.java:125] Shutting down extension system
2019-07-16 19:22:36,671 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook ManagedExtensionExecutorService shutdown
2019-07-16 19:22:36,672 DEBUG [shutdown-executor] c.h.e.s.e.ManagedPluginExecutorShutdownHook [ManagedPluginExecutorShutdownHook.java:65] Shutting down managed extension executor service
2019-07-16 19:22:36,672 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook Extension Timeout Executor Shutdown Hook
2019-07-16 19:22:36,672 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook Persistence Shutdown
2019-07-16 19:22:36,672 TRACE [shutdown-executor] c.h.p.PersistenceShutdownHook [PersistenceShutdownHook.java:107] Shutting down persistent stores
2019-07-16 19:22:39,191 TRACE [shutdown-executor] c.h.p.PersistenceShutdownHook [PersistenceShutdownHook.java:129] Finished persistence shutdown in 2519 ms
2019-07-16 19:22:39,191 TRACE [shutdown-executor] c.h.p.PersistenceShutdownHook [PersistenceShutdownHook.java:140] Shutting down persistent stores
2019-07-16 19:22:39,191 TRACE [shutdown-executor] c.h.p.PersistenceShutdownHook [PersistenceShutdownHook.java:149] Finished single writer shutdown in 0 ms
2019-07-16 19:22:39,192 TRACE [shutdown-executor] c.h.c.s.ShutdownHooks [ShutdownHooks.java:108] Running shutdown hook Metrics Shutdown

Here is the diagonstics.txt
/ // () _____ / |/ / __ \ / _ ()__ ____ ____ ___ ___ / /()______
/ _ / / |/ / -) /|/ / // / / // / / _ / _ / _ / _ (-</ / / (-<
/
////|
/_// /_/_
_\ ///_,/_, ////_//_//_//
/
_/

Generated at 2019-07-16T19:27:38.945210
Please send this file along with any other files in the 'diagnostic' folder to [email protected].

##############################

HiveMQ Information

##############################

[HiveMQ Version] = [2019.1]

##############################

Java System Properties

##############################

[awt.toolkit] = [sun.awt.X11.XToolkit]
[java.specification.version] = [11]
[hivemq.home] = [/etc/service/hivemq]
[sun.cpu.isalist] = []
[sun.jnu.encoding] = [UTF-8]
[java.class.path] = [/etc/service/hivemq/bin/hivemq.jar]
[com.sun.management.jmxremote.authenticate] = [false]
[java.vm.vendor] = [Oracle Corporation]
[sun.arch.data.model] = [64]
[java.vendor.url] = [http://java.oracle.com/]
[user.timezone] = [Asia/Jakarta]
[os.name] = [Linux]
[java.vm.specification.version] = [11]
[sun.java.launcher] = [SUN_STANDARD]
[sun.boot.library.path] = [/usr/lib/jvm/java-11-openjdk-amd64/lib]
[com.sun.management.jmxremote.ssl] = [false]
[sun.java.command] = [/etc/service/hivemq/bin/hivemq.jar]
[com.sun.management.jmxremote] = []
[jdk.debug] = [release]
[sun.cpu.endian] = [little]
[user.home] = [/root]
[user.language] = [en]
[java.specification.vendor] = [Oracle Corporation]
[java.version.date] = [2019-04-16]
[java.home] = [/usr/lib/jvm/java-11-openjdk-amd64]
[file.separator] = [/]
[hivemq.log.folder] = [/etc/service/hivemq/log]
[java.vm.compressedOopsMode] = [32-bit]
[line.separator] = [
]
[java.specification.name] = [Java Platform API Specification]
[java.vm.specification.vendor] = [Oracle Corporation]
[com.sun.management.jmxremote.local.only] = [false]
[java.awt.graphicsenv] = [sun.awt.X11GraphicsEnvironment]
[sun.management.compiler] = [HotSpot 64-Bit Tiered Compilers]
[diagnosticMode] = [true]
[java.runtime.version] = [11.0.3+7-Ubuntu-1ubuntu218.04.1]
[user.name] = [root]
[java.net.preferIPv4Stack] = [true]
[path.separator] = [:]
[java.security.egd] = [file:/dev/./urandom]
[os.version] = [4.15.0-1043-aws]
[java.runtime.name] = [OpenJDK Runtime Environment]
[file.encoding] = [UTF-8]
[sun.nio.ch.bugLevel] = []
[java.vm.name] = [OpenJDK 64-Bit Server VM]
[java.vendor.url.bug] = [http://bugreport.java.com/bugreport/]
[java.io.tmpdir] = [/tmp]
[java.version] = [11.0.3]
[com.sun.management.jmxremote.port] = [9010]
[user.dir] = [/]
[os.arch] = [amd64]
[java.vm.specification.name] = [Java Virtual Machine Specification]
[java.awt.printerjob] = [sun.print.PSPrinterJob]
[sun.os.patch.level] = [unknown]
[java.library.path] = [/usr/java/packages/lib:/usr/lib/x86_64-linux-gnu/jni:/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:/usr/lib/jni:/lib:/usr/lib]
[java.vendor] = [Oracle Corporation]
[java.vm.info] = [mixed mode, sharing]
[java.vm.version] = [11.0.3+7-Ubuntu-1ubuntu218.04.1]
[java.rmi.server.randomIDs] = [true]
[sun.io.unicode.encoding] = [UnicodeLittle]
[java.class.version] = [55.0]

##############################

System Information

##############################

[Available Processors] = [2]
[System Load Average] = [1.26]
[Total Swap Space Size] = [0]
[Committed Virtual Memory Size] = [3785256960]
[Total Physical Memory Size] = [3785256960]
[Max File Descriptor Count] = [4096]
[Open File Descriptor Count] = [991]

##############################

Network Interfaces

##############################

┌[ens5]
├─[Display Name] = [ens5]
├─[MAC Address] = [06-51-2D-BD-08-0E]
├─[MTU] = [9001]
├─[Is Loopback?] = [false]
├─[Is P2P?] = [false]
├─[Is Up?] = [true]
├─[Is Virtual?] = [false]
├─[Supports Multicast?] = [true]
└─[Inet Addresses]
├─[/10.20.21.130]

┌[lo]
├─[Display Name] = [lo]
├─[MAC Address] = [Could not determine MAC Address]
├─[MTU] = [65536]
├─[Is Loopback?] = [true]
├─[Is P2P?] = [false]
├─[Is Up?] = [true]
├─[Is Virtual?] = [false]
├─[Supports Multicast?] = [false]
└─[Inet Addresses]
├─[/127.0.0.1]

Unexpected behaviour of PublishInboundInterceptor and PublishService

Expected behavior

A PUBLISH that is sent via the Publish Service is processed identical to a PUBLISH sent by a client. See: https://www.hivemq.com/docs/4.1/extensions/services.html#publish-service

Actual behavior

A PUBLISH that is sent via the Publish Services isn't triggering the registered PublishInboundInterceptor.

To Reproduce

Steps

Publish a message via PublishService and the PublishInboundInterceptor isn't getting called.
Publish a message via MQTT Client and the PublishInboundInterceptor is getting called.

Reproducer code

        //Publish message "test" to topic "test" every 5 seconds
        final PublishService publishService = Services.publishService();
        final ManagedExtensionExecutorService executorService = Services.extensionExecutorService();

        final Publish publish = Builders.publish()
                .topic("test")
                .qos(Qos.AT_LEAST_ONCE)
                .payload(StandardCharsets.UTF_8.encode("test"))
                .build();

        executorService.scheduleAtFixedRate(new Runnable() {
            @Override
            public void run() {
                publishService.publish(publish);
                LOG.info("PublishService published message");
            }
        }, 5000, 5000, TimeUnit.MILLISECONDS);


        //publish inbound interceptor logging received publishes
        final PublishInboundInterceptor publishInboundInterceptor = new PublishInboundInterceptor() {
            @Override
            public void onInboundPublish(@NotNull PublishInboundInput publishInboundInput, @NotNull PublishInboundOutput publishInboundOutput) {
                if (!publishInboundInput.getPublishPacket().getPayload().isPresent()) {
                    LOG.info("No payload present");
                    return;
                }
                ByteBuffer payloadBuffer = publishInboundInput.getPublishPacket().getPayload().get();
                LOG.info("Incoming publish with message: " + StandardCharsets.UTF_8.decode(payloadBuffer));
            }
        };

        final ClientInitializer clientInitializer = new ClientInitializer() {
            @Override
            public void initialize(@NotNull InitializerInput initializerInput, @NotNull ClientContext clientContext) {
                clientContext.addPublishInboundInterceptor(publishInboundInterceptor);
            }
        };

        Services.initializerRegistry().setClientInitializer(clientInitializer);

Details

  • Affected HiveMQ CE version(s): all
  • Used JVM version: 12 Open JDK

Check for existing heap-dump file and archive

As HiveMQ administrator I want HiveMQ to archive an existing heap-dump.prof Heap Dump file in the HiveMQ home folder, so it doesn't get overwritten if HiveMQ exits with an Out of Memory Error.

Cannot find running process and physical processor on arm64

Expected behavior

No error?

Actual behavior

Error in the output:
Sep 12 00:11:13 Khadas run.sh[5616]: 2019-09-12 00:11:12,921 INFO - Log Configuration was overridden by /home/khadas/Downloads/hivemq-ce-2019.1/conf/logback.xml
Sep 12 00:11:13 Khadas run.sh[5616]: 2019-09-12 00:11:13,647 INFO - This HiveMQ ID is QzF87
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,421 INFO - Starting HiveMQ extension system.
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,459 INFO - Starting TCP listener on address 0.0.0.0 and port 1883
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,554 INFO - Started TCP Listener on address 0.0.0.0 and on port 1883
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,555 INFO - Started HiveMQ in 5772ms
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,641 ERROR - Couldn't find any running processes, which is odd since we are in a running process. Process time values are in jiffies, not milliseconds.
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,815 ERROR - Couldn't find any running processes, which is odd since we are in a running process. Process time values are in jiffies, not milliseconds.
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,828 ERROR - Couldn't find physical processor count. Assuming 1.
Sep 12 00:11:18 Khadas run.sh[5616]: 2019-09-12 00:11:18,829 ERROR - Couldn't find physical package count. Assuming 1.

To Reproduce

Steps

Download the zip file, unzip and run according to the instruction. Then in the terminal there are errors in the output. Perhaps it is due to the arm64?

Reproducer code

Details

  • Affected HiveMQ CE version(s): 2019.1
  • Used JVM version:

Not possible to build retainedPublish from a publish

Expected behavior

I can build a retained publish based on a publish vie the Builders in the extension system.

@NotNull final Publish publish = Builders.publish().topic("test").payload(ByteBuffer.wrap("test".getBytes())).build();
@NotNull final RetainedPublish retainedPublish = Builders.retainedPublish().fromPublish(publish).build();

Actual behavior

Building a retained publish from a publish throws an error:

2019-10-16 17:29:37,472 WARN  - Uncaught exception was thrown from extension with id "test-extension" on connack interception. The exception should be handled by the extension.
2019-10-16 17:29:37,475 DEBUG - Original exception:
java.lang.IllegalArgumentException: Message expiry interval 4294967296 not allowed. Maximum = 4294967296
	at com.google.common.base.Preconditions.checkArgument(Preconditions.java:141)
	at com.hivemq.extensions.services.builder.PluginBuilderUtil.checkMessageExpiryInterval(PluginBuilderUtil.java:45)
	at com.hivemq.extensions.services.builder.RetainedPublishBuilderImpl.messageExpiryInterval(RetainedPublishBuilderImpl.java:191)
	at com.hivemq.extensions.services.builder.RetainedPublishBuilderImpl.fromComplete(RetainedPublishBuilderImpl.java:144)
	at com.hivemq.extensions.services.builder.RetainedPublishBuilderImpl.fromPublish(RetainedPublishBuilderImpl.java:126)
	at com.hivemq.testsuite.extensions.contextclassloader.ContextClassLoaderUtil.useBuildersAndServices(ContextClassLoaderUtil.java:76)
	at com.hivemq.testsuite.extensions.contextclassloader.ContextClassLoaderExtensionMain$3.getConnackOutboundInterceptor(ContextClassLoaderExtensionMain.java:454)
	at com.hivemq.extensions.handler.ConnackOutboundInterceptorHandler$ConnackInterceptorTask.apply(ConnackOutboundInterceptorHandler.java:268)
	at com.hivemq.extensions.handler.ConnackOutboundInterceptorHandler$ConnackInterceptorTask.apply(ConnackOutboundInterceptorHandler.java:248)
	at com.hivemq.extensions.executor.task.PluginTaskExecutor$PluginTaskExecutorRunnable.runInOutTask(PluginTaskExecutor.java:333)
	at com.hivemq.extensions.executor.task.PluginTaskExecutor$PluginTaskExecutorRunnable.runTask(PluginTaskExecutor.java:303)
	at com.hivemq.extensions.executor.task.PluginTaskExecutor$PluginTaskExecutorRunnable.executeTask(PluginTaskExecutor.java:252)
	at com.hivemq.extensions.executor.task.PluginTaskExecutor$PluginTaskExecutorRunnable.run(PluginTaskExecutor.java:165)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:834)

To Reproduce

Steps

  • build extension that contains reproducer code
  • start HiveMQ with extension
  • error is thrown

Reproducer code

@NotNull final Publish publish = Builders.publish().topic("test").payload(ByteBuffer.wrap("test".getBytes())).build();
@NotNull final RetainedPublish retainedPublish = Builders.retainedPublish().fromPublish(publish).build();

Details

This happens because the check in PluginBuilderUtil.checkMessageExpiryInterval checks for for < instead of <=, as a message expiry == maxMessageExpiry is also valid (currently it isn't):

  public static void checkMessageExpiryInterval(final long messageExpiryInterval, final long maxMessageExpiryInterval) {
        checkArgument(messageExpiryInterval < maxMessageExpiryInterval,
                "Message expiry interval " + messageExpiryInterval + " not allowed. Maximum = " + maxMessageExpiryInterval);
        checkArgument(messageExpiryInterval > 0,
                "Message expiry interval must be bigger than 0 was " + messageExpiryInterval + ".");
    }

Further: This doesn't occur in the Enterprise version and building a retained publish from scratch is not an issue

mqtt terminating issue

i am using HiveMQ MQTT broker in AWS EC2 ubuntu 18. mqtt works fine in AWS t2.micro, but moves to t2.medium it start terminating. If i again move to t2.micro works good. i don't know why mqtt start terminating if i move to t2.medium. i did't use SSL/TLS.

Mosquitto.conf
pid_file /var/run/mosquitto.pid
persistence true
persistence_location /var/lib/mosquitto/
log_dest file /var/log/mosquitto/mosquitto.log
include_dir /etc/mosquitto/conf.d
require_certificate false
log_type all

please help me for this issue.
Thanks in asvance.

Add LWT metrics

HiveMQ does currently hold no metrics about LWT. We should at least add the basic metrics like "current.count" for it.

Define ClientLifecycleEventListener's methods with default

Problem or use case

When implementing ClientLifecycleEventListener interface, one basically may not need for onAuthenticationSuccessful() but still have to override it and let empty method body.

Preferred solution or suggestions

Mark onMqttConnectionStart(), onAuthenticationSuccessful() and onDisconnect() with default keyword so extension developer may override only methods he/she needs.

Retry Offline Messages

Hi Team,

Is there a way, when the device comes online, can we immediately deliver the offline message. Please let me know, any parameter change is required.

Embedded broker as maven dependency

Problem or use case

I would like to test my mqtt client/broker setup using JUnit tests.
Since it is cumbersome to start a broker before running the tests, an embedded MQTT 5 compliant broker would ease up the testing.

Preferred solution or suggestions

  • HiveMQ broker as maven dependency
  • Documentation on how to start the broker within a running Java process (e.g. Junit test)

Notification if HiveMQ starts without Security Extension in CE

Acceptance Criteria:

  • Notification occurs if HiveMQ has been started without security extension

  • Notification doesn't occur if HiveMQ has been starten with security extension

  • The notification is big and can't be overseen

  • The notification occurs at HiveMQ start up

  • If this notification occurs HiveMQ can be stopped immediately

Prometheus extension not working

Actual behavior

Starting the broker with the prometheus extension results in this error log:

2019-07-24 13:19:57,125 INFO  - Starting HiveMQ Community Edition Server
2019-07-24 13:19:57,127 INFO  - HiveMQ version: 2019.1
2019-07-24 13:19:57,127 INFO  - HiveMQ home directory: /opt/hivemq
2019-07-24 13:19:57,162 INFO  - Log Configuration was overridden by /opt/hivemq/conf/logback.xml
2019-07-24 13:19:57,356 INFO  - This HiveMQ ID is mwDbQ
2019-07-24 13:20:14,353 INFO  - Created user preferences directory.
2019-07-24 13:20:14,873 INFO  - Starting HiveMQ extension system.
2019-07-24 13:20:14,925 INFO  - Starting TCP listener on address 0.0.0.0 and port 1883
2019-07-24 13:20:14,998 INFO  - Started TCP Listener on address 0.0.0.0 and on port 1883
2019-07-24 13:20:14,999 INFO  - Started HiveMQ in 17877ms
2019-07-24 13:20:15,040 ERROR - Extension with id "hivemq-prometheus-extension" cannot be started because of an uncaught exception thrown by the extension. Extension will be disabled.
java.lang.NoClassDefFoundError: javax/servlet/ServletContextListener
        at org.eclipse.jetty.server.handler.ContextHandler.<clinit>(ContextHandler.java:114)
        at com.hivemq.extensions.prometheus.export.PrometheusServer.start(PrometheusServer.java:64)
        at com.hivemq.extensions.prometheus.PrometheusMainClass.extensionStart(PrometheusMainClass.java:65)
        at com.hivemq.extensions.HiveMQExtensionImpl.start(HiveMQExtensionImpl.java:133)
        at com.hivemq.extensions.HiveMQPlugins.pluginStart(HiveMQPlugins.java:209)
        at com.hivemq.extensions.loader.PluginLifecycleHandlerImpl.lambda$startPlugin$0(PluginLifecycleHandlerImpl.java:82)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContextListener
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
        at com.hivemq.extensions.classloader.IsolatedPluginClassloader.loadClass(IsolatedPluginClassloader.java:123)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
        ... 9 common frames omitted

To Reproduce

Steps

Details

  • Affected HiveMQ CE version(s):
  • Used JVM version: OpenJDK 11

Solution

I could solve this issue by downloading the broker source code and add this dependency to the javax section in the build.gradle file:
[group: 'javax.servlet', name: 'javax.servlet-api', version: '4.0.1'],

Then compile it and use the precompiled prometheus extension from the marketplace.
After that the extension seems to be working.

V5 connection connack missing authentication method

Expected behavior

The CONNACK packet sent by the broker in response to a successful v5 client authentication request must contain the same authentication method value as specified by the CONNECT packet, as specified in the MQTTv5 protocol specification:
If the initial CONNECT packet included an Authentication Method property then all AUTH packets, and any successful CONNACK packet MUST include an Authentication Method Property with the same value as in the CONNECT packet [MQTT-4.12.0-5].

Actual behavior

At the moment the v5 CONNACK is always sent with an empty authentication method field

To Reproduce

Steps

Use a v5 client (hivemq client works as well) to authenticate with the broker using an extended authentication method (in my case it's an extension of SimpleAuthenticator). The broker successfully authenticates the client and sends a CONNACK but the client rejects the connection because of this

Details

  • Affected HiveMQ CE version(s): latest
  • Used JVM version: 11

Proposed bugfix:

In ConnectHandler.java, method buildMqtt5Connack:

        final CONNACK.Mqtt5Builder builder = new CONNACK.Mqtt5Builder()
                .withSessionPresent(sessionPresent)
                .withReasonCode(Mqtt5ConnAckReasonCode.SUCCESS)
                .withReceiveMaximum(configurationService.mqttConfiguration().serverReceiveMaximum())
                .withSubscriptionIdentifierAvailable(configurationService.mqttConfiguration().subscriptionIdentifierEnabled())
                .withMaximumPacketSize(configurationService.mqttConfiguration().maxPacketSize())
                .withWildcardSubscriptionAvailable(configurationService.mqttConfiguration().wildcardSubscriptionsEnabled())
                .withSharedSubscriptionAvailable(configurationService.mqttConfiguration().sharedSubscriptionsEnabled())
                .withMaximumQoS(configurationService.mqttConfiguration().maximumQos())
                .withRetainAvailable(configurationService.mqttConfiguration().retainedMessagesEnabled());

A .withAuthMethod(msg.getAuthMethod()); is missing from there

About the HIveMQ authentication MQTT client user password method

hello,
Dear author
I wonder how HiveMQ CE enables MQTT client user password authentication

I did not find any information in the literature about HIveMQ's method of validating MQTT client user passwords but It supports
Can you tell me how to configure it?

Docker

Are you going to support an official docker image?

Windows service doesn't work

Follow up ticket from discussion:
https://community.hivemq.com/t/hivemq-as-windows-service/108

Expected behavior

Following the steps for installing HiveMQ as a windows service, I would expect a running HiveMQ service.

Actual behavior

The used wrapper is not working with the Java versions required by HiveMQ CE (at least Java 11).

To Reproduce

Steps

  • Download HiveMQ CE
  • Download the windows service zip
  • Start normal -> works
  • Install HiveMQ as a service (follow steps here)
  • Service is installed but can't be started:
    Bildschirmfoto 2019-11-20 um 10 28 35

Details

  • Affected HiveMQ CE version(s): Any
  • Used JVM version: 11.0.2 and 12.0.2
  • Tested Windows version: Windows 10 Pro (version 1803) and Windows 10 Enterprise (version 18362)

Wrong Connack Reason code for Bad username or password

Expected behavior

When an authenticator sets that the client failed authentication with reason code BAD USERNAME OR PASSWORD, the client should receive this same code

Actual behavior

The client receives BAD_AUTHENTICATION_METHOD reason code instead

To Reproduce

Steps

Just create an extension and fail the requested connect packet with a BAD_USERNAME_OR_PASSWORD reason code and see that the client receives BAD_AUTHENTICATION_METHOD.

Buggy code

In ReasonCodeUtil.java, this extract of code:

            case BAD_USER_NAME_OR_PASSWORD:
                return Mqtt5ConnAckReasonCode.BAD_AUTHENTICATION_METHOD;
            case SERVER_UNAVAILABLE:
                return Mqtt5ConnAckReasonCode.SERVER_UNAVAILABLE;
            case SERVER_BUSY:
                return Mqtt5ConnAckReasonCode.SERVER_BUSY;
            case BANNED:
                return Mqtt5ConnAckReasonCode.BANNED;
            case BAD_AUTHENTICATION_METHOD:
                return Mqtt5ConnAckReasonCode.BAD_AUTHENTICATION_METHOD;

Obviously, the first one is wrong and should be:

            case BAD_USER_NAME_OR_PASSWORD:
                return Mqtt5ConnAckReasonCode.BAD_USER_NAME_OR_PASSWORD;

Details

  • Affected HiveMQ CE version(s): latest
  • Used JVM version: 11

Package Manager for HiveMQ CE

HiveMQ CE should be available via Package Manager like Homebrew, deb, RPM, ... to ease the installation process. This should be part of every community release to trigger a job that releases the new HiveMQ Version for all Package Manager.

Implement UNSUBSCRIBE Inbound Interceptor

USER STORIES:

As HiveMQ Extension Developer I want to intercept an incoming UNSUBSCRIBE packet so that I am able to modify this packet.

EXAMPLE USE CASES:

  • Migration Scenario: Old Clients that use an outdated topic filter to unsubscribe to and need to be redirected to the new topic filter

ACCEPTANCE CRITERIA:

  • Every incoming UNSUBSCRIBE message can be intercepted
  • Adding, modifying and removing of topics is possible
  • Removing means sending an UNSUBACK with error code (?)
  • Should be possible to reject the subscription of a single topic (= SUBACK with error code)

NOTES:

When integrate SpringBoot and kafka client into the extension,an exception has been throwed

when receiveed a kafka message in my extension module, and I want to send this message using

Services.publishService().publish

Expected behavior

it's work

Actual behavior

java.lang.RuntimeException: Static class Builders cannot be called from a thread "kafkaMessageListenerContainer-C-1" which does not have a HiveMQ extension classloader as its context classloader.
at com.hivemq.extension.sdk.api.services.builder.Builders.getClassSupplier(Builders.java:98)
at com.hivemq.extension.sdk.api.services.builder.Builders.publish(Builders.java:67)
at com.hivemq.extension.sdk.api.services.publish.Publish.builder(Publish.java:47)
at com.caocao.hivemq.extension.kafka.TestHandler.handle(TestHandler.java:39)
at com.caocao.hivemq.extension.kafka.KafkaMessageListener.onMessage(KafkaMessageListener.java:79)
at com.caocao.hivemq.extension.kafka.KafkaMessageListener.onMessage(KafkaMessageListener.java:40)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeOnMessage(KafkaMessageListenerContainer.java:1278)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeOnMessage(KafkaMessageListenerContainer.java:1256)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeRecordListener(KafkaMessageListenerContainer.java:1217)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.doInvokeWithRecords(KafkaMessageListenerContainer.java:1198)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeRecordListener(KafkaMessageListenerContainer.java:1118)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.invokeListener(KafkaMessageListenerContainer.java:933)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.pollAndInvoke(KafkaMessageListenerContainer.java:749)
at org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer.run(KafkaMessageListenerContainer.java:698)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java)
at java.base/java.lang.Thread.run(Thread.java:834)

To Reproduce

Steps

Reproducer code

Details

  • Affected HiveMQ CE version(s):
  • Used JVM version:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.