Hi,
I am using the MQTT Broker in my B4J app and I am not 100% sure if the following error is released to the MQTT Broker & MQTT Client.
I have a MQTT Broker running in my B4J app. - https://www.b4x.com/android/forum/threads/mqttbroker.61548/#content
The B4J also connects to this broker. (MQTT Client).
My B4A/B4i apps will subscribe to topics and the B4J MQTT Client will publish to the topics that the MQTT in B4A/B4i are subscribed to.
I have a timer running in my B4J app which will run every 2 seconds to check if the MQTT Client is connected to the broker. (not sure if this is a good idea or not, or if this is the correct thing to do) If it's not connected then it will connect to the broker. This way the B4J app won't be disconnected from the broker and if it does it will be only for a short time.
For some reason the B4J app is running out of memory and I think it's related to the MQTT, since this is the last thing I added to the B4J app and now this issue is happening.
The Server is logging the following error..
In my server log I am seeing a lot of the following being logged:
The above doesn't seem to happen all the time.
The B4J app is the only device that will ever use the ClientID which starts with CloudServer. I am initialing it like:
So, I know it has a unique ClientID.
My B4J Broker is running version 1.03 and MQTT Client is running 1.00
I do notice there is a new MQTT Broker version available, but haven't updated to it yet.
As my server log is logging:
I am assuming the out of memory is because of the MQTT somehow ?
I am running my B4J app as service on the Linux VPS using:
Should I be running my B4J app by adding something to increase the Java Heap Space or is it due to the MQTT causing the error?
I am running the web server in my B4J app as well.
I can't seem to work out what is causing this error or how to fix it.
I am using the MQTT Broker in my B4J app and I am not 100% sure if the following error is released to the MQTT Broker & MQTT Client.
I have a MQTT Broker running in my B4J app. - https://www.b4x.com/android/forum/threads/mqttbroker.61548/#content
The B4J also connects to this broker. (MQTT Client).
My B4A/B4i apps will subscribe to topics and the B4J MQTT Client will publish to the topics that the MQTT in B4A/B4i are subscribed to.
I have a timer running in my B4J app which will run every 2 seconds to check if the MQTT Client is connected to the broker. (not sure if this is a good idea or not, or if this is the correct thing to do) If it's not connected then it will connect to the broker. This way the B4J app won't be disconnected from the broker and if it does it will be only for a short time.
For some reason the B4J app is running out of memory and I think it's related to the MQTT, since this is the last thing I added to the B4J app and now this issue is happening.
The Server is logging the following error..
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-21"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-23"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-24"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-2"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-0"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "MQTT Ping: CloudServer1571683031905834035122"
Unexpected exception in the selector loop.
Unexpected exception in the selector loop.
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "pool-1-thread-1"
An exception was thrown by a user handler's exceptionCaught() method while handling the following exception:
java.lang.OutOfMemoryError: Java heap space
message repeated 5 times: [ java.lang.OutOfMemoryError: Java heap space]
java.lang.OutOfMemoryError: Java heap space
message repeated 4 times: [ java.lang.OutOfMemoryError: Java heap space]
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp815992954-17905"
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp815992954-17503"
java.lang.OutOfMemoryError: Java heap space
message repeated 2 times: [ java.lang.OutOfMemoryError: Java heap space]
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp815992954-18014"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp815992954-17056"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Thread-22"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp815992954-16957"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "qtp815992954-32"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Scheduler-1327536153"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "nioEventLoopGroup-2-1"
Unexpected exception in the selector loop.
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
Unexpected thread death: org.eclipse.jetty.util.thread.QueuedThreadPool$2@2652bea7 in QueuedThreadPool[qtp1781071780]@6a28ffa4{STARTED,8<=8<=200,i=2,q=0}[ReservedThreadExecutor@1f61eb5b{s=0/2,p=0}]
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
Unexpected thread death: org.eclipse.jetty.util.thread.QueuedThreadPool$2@2652bea7 in QueuedThreadPool[qtp1781071780]@6a28ffa4{STARTED,8<=8<=200,i=1,q=0}[ReservedThreadExecutor@1f61eb5b{s=1/2,p=0}]
Severe error during pipeline creation
An exception was thrown by a user handler's exceptionCaught() method while handling the following exception:
message repeated 2 times: [ An exception was thrown by a user handler's exceptionCaught() method while handling the following exception:]
A task raised an exception.
An exception was thrown by a user handler's exceptionCaught() method while handling the following exception:
Unexpected thread death: org.eclipse.jetty.util.thread.QueuedThreadPool$2@2652bea7 in QueuedThreadPool[qtp1781071780]@6a28ffa4{STARTED,8<=9<=200,i=1,q=0}[ReservedThreadExecutor@1f61eb5b{s=1/2,p=0}]
Unexpected thread death: org.eclipse.jetty.util.thread.QueuedThreadPool$2@2652bea7 in QueuedThreadPool[qtp1781071780]@6a28ffa4{STARTED,8<=9<=200,i=0,q=0}[ReservedThreadExecutor@1f61eb5b{s=1/2,p=0}]
java.lang.OutOfMemoryError: Java heap space
In my server log I am seeing a lot of the following being logged:
Serious error processing the message org.eclipse.moquette.proto.messages.PublishMessage@2db4cb67 for session [clientID: CloudServer1571683031905834035122]org.eclipse.moquette.server.netty.NettyChannel@4b1dfbd2
The above doesn't seem to happen all the time.
The B4J app is the only device that will ever use the ClientID which starts with CloudServer. I am initialing it like:
B4X:
MqttClient.Initialize("MqttClient","tcp://127.0.0.1:5432","CloudServer" & DateTime.Now & Rnd(1000,9999999999999999))
So, I know it has a unique ClientID.
My B4J Broker is running version 1.03 and MQTT Client is running 1.00
I do notice there is a new MQTT Broker version available, but haven't updated to it yet.
As my server log is logging:
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "MQTT Ping: CloudServer1571683031905834035122"
I am assuming the out of memory is because of the MQTT somehow ?
I am running my B4J app as service on the Linux VPS using:
B4X:
[Unit]
Description=CloudServer Service
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/java -jar /opt/CloudServer/CloudServer.jar
StandardOutput=syslog
StandardError=syslog
SuccessExitStatus=143
Restart=on-abort
[Install]
WantedBy=multi-user.target
Should I be running my B4J app by adding something to increase the Java Heap Space or is it due to the MQTT causing the error?
I am running the web server in my B4J app as well.
I can't seem to work out what is causing this error or how to fix it.
Last edited: