-
Notifications
You must be signed in to change notification settings - Fork 641
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
Alpakka Mqtt streaming continuos failure #1833
Comments
Thanks for the report.
Are you saying that you don’t expect your source to terminate if there’s no acknowledgment to the subscription?
Are you sure your broker is acknowledging?
… On 22 Jul 2019, at 23:26, Ikenna Darlington Ogbajie ***@***.***> wrote:
Versions used
Akka version: 2.5.23
HiveMQ: 4.1.1
Alpakka-mqtt-streaming: 2.12_1.1.0
Scala: 2.12.8
Source is created this way:
val (commands, source) = Source
.queue(
mqttBrokerConfig.connectorBuffer,
OverflowStrategy.backpressure
)
.via(mqttFlow)
.collect {
case Right(Event(publishEvent: Publish, _)) => publishEvent
}
.preMaterialize()
Expected Behavior
Source doesn't get killed but continues streaming events.
Actual Behavior
Source gets killed and this error shows up:
akka.stream.alpakka.mqtt.streaming.impl.Subscriber$SubscribeFailed$: null
Relevant logs
Stack trace:
2019-07-18 08:00:38,343 ERROR a.a.t.i.a.ActorAdapter [default-akka.actor.default-dispatcher-17] null
akka.stream.alpakka.mqtt.streaming.impl.Subscriber$SubscribeFailed$: null
2019-07-18 08:00:38,343 ERROR a.a.t.i.a.ActorAdapter [default-akka.actor.default-dispatcher-17] null
akka.stream.alpakka.mqtt.streaming.impl.Subscriber$SubscribeFailed$: null
2019-07-18 08:00:38,345 DEBUG a.s.a.m.s.i.Subscriber$ [default-akka.actor.default-dispatcher-2] Cancel all timers
2019-07-18 08:00:38,345 DEBUG a.s.a.m.s.i.Subscriber$ [default-akka.actor.default-dispatcher-2] Cancel all timers
2019-07-18 08:00:38,357 DEBUG a.s.Materializer [default-akka.actor.default-dispatcher-16] [client-commandFlow] Upstream failed, cause: ActorMqttClientSession$SubscribeFailed$: null
2019-07-18 08:00:38,357 DEBUG a.s.Materializer [default-akka.actor.default-dispatcher-16] [client-commandFlow] Upstream failed, cause: ActorMqttClientSession$SubscribeFailed$: null
2019-07-18 08:00:38,358 DEBUG a.a.RepointableActorRef [default-akka.actor.default-dispatcher-14] Aborting tcp connection to [redacted] because of upstream failure: akka.stream.alpakka.mqtt.streaming.scaladsl.ActorMqttClientSession$SubscribeFailed$
2019-07-18 08:00:38,358 DEBUG a.a.RepointableActorRef [default-akka.actor.default-dispatcher-14] Aborting tcp connection to [redacted] because of upstream failure: akka.stream.alpakka.mqtt.streaming.scaladsl.ActorMqttClientSession$SubscribeFailed$
2019-07-18 08:00:38,359 DEBUG a.s.Materializer [default-akka.actor.default-dispatcher-4] [client-events] Upstream failed, cause: ActorMqttClientSession$SubscribeFailed$: null
2019-07-18 08:00:38,359 DEBUG a.s.Materializer [default-akka.actor.default-dispatcher-4] [client-events] Upstream failed, cause: ActorMqttClientSession$SubscribeFailed$: null
Reproducible Test Case
Please provide a PR with a failing test.
If the issue is more complex or requires configuration, please provide a link to a project that reproduces the issue.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
@huntc The source actually consumes messages, then shuts down. In the actual implementation, we used a restartable source and found the bug as it was continuously restarting after consuming events for a while. |
The exception you’re seeing is because there’s no SUBACK. Wireshark should confirm this for you. If you see there’s a SUBACK then we have a problem. Can you investigate a bit more? Also, a reproducer would be great. Note we’ve not seen problems in this area. Thanks again for the report. |
Also, you may want to pass in a promise to the SUBSCRIBE command. That promise will be returned when you receive the SUBACK. May be you need this synchronisation. |
Thanks for the pointer on SUBACK @huntc So the client was trying to subscribe to some topics where it didn't have permissions. It got a successful SUBACK for the topics with the right permission and a BadSubAckMessage for the topics without permission. This was what I noticed in the log:
Resolved this by configuring the app to subscribe to all the right topics. It will help if the error messages are more helpful. |
I'm very pleased that you found the problem. Any thoughts on how we can improve the messages? It is always hard to know what to log, as we don't want to log too much and, not being able to subscribe isn't technically an error. Subscriptions should of course always be checked for their success. |
Perhaps we should even consider updating our docs to cover-off subscription checking? |
Thanks @huntc For the error messages, rather than have Subscribe failure without some information like:
I will prefer the SubscribeFailed failure comes with some description like:
Let me know what you think. |
In the case of |
Sure :) |
So @huntc I noticed: When the event flow receives Subscribe Ack composed of Failures and Sucess, it decodes it as a I am not sure that is correct behavior. Should the flow fail because of partial subscription failure? for eg
results to:
|
I think that it is an application concern as to whether the flow should fail or not. |
I am not sure the application has control over that because the Subscriber never gets the Subscribe Ack since it is decoded as BadSubAck message. Therefore it times out and the flow shuts down. Is there some other way to control this? |
Sounds like a bug. I can try and take a look over the weekend. |
If you get a chance to raise a PR for adding a unit test to reproduce the condition then that could help me too. Thanks for the report. |
@idarlington Please review #1845 - perhaps verify by building the PR branch locally. |
Versions used
Source is created this way:
Expected Behavior
Source doesn't get killed but continues streaming events.
Actual Behavior
Source gets killed and this error shows up:
Relevant logs
Stack trace:
Reproducible Test Case
I noticed this is the hivemq logs when it happens:
The text was updated successfully, but these errors were encountered: