hnaderi/lepus

AMQP Spec Heartbeat differs from RabbitMQ Heartbeat

reardonj opened this issue · 3 comments

Hi, I'm trying out your library, but when I run a consumer, I eventually get this decoding error:

root failed to decode BitVector(64 bits, 0x08000000000000ce): expected constant BitVector(8 bits, 0xce) but got BitVector(8 bits, 0x00)

This is a heartbeat message, but as provided by the server I'm using, has a full AMQP frame, instead of the short heartbeat frame in the spec. This appears to be a common spec deviation mentioned in the RabbitMQ documentation. Is it possible to support this version of the heartbeat as well?


Full error and stack trace for reference:

root failed to decode BitVector(64 bits, 0x08000000000000ce): expected constant BitVector(8 bits, 0xce) but got BitVector(8 bits, 0x00)
root[ERROR] fs2.CompositeFailure: Multiple exceptions were thrown (2), first fs2.interop.scodec.CodecError: expected constant BitVector(8 bits, 0xce) but got BitVector(8 bits, 0x00)
root[ERROR]     at fs2.CompositeFailure$.apply(CompositeFailure.scala:58)
root[ERROR]     at fs2.CompositeFailure$.apply(CompositeFailure.scala:45)
root[ERROR]     at fs2.CompositeFailure$.fromResults$$anonfun$1(CompositeFailure.scala:88)
root[ERROR]     at scala.util.Either.fold(Either.scala:190)
root[ERROR]     at fs2.CompositeFailure$.fromResults(CompositeFailure.scala:88)
root[ERROR]     at fs2.Stream.$anonfun$26$$anonfun$1$$anonfun$1(Stream.scala:1974)
root[ERROR]     at map @ fs2.Stream.$anonfun$26$$anonfun$1$$anonfun$1(Stream.scala:1975)
root[ERROR]     at get @ lepus.client.internal.ConnectionState$$anon$1.awaitOpened(ConnectionState.scala:107)
root[ERROR]     at get @ lepus.client.internal.ConnectionState$$anon$1.awaitOpened(ConnectionState.scala:107)
root[ERROR]     at flatMap @ fs2.Stream.$anonfun$26$$anonfun$1(Stream.scala:1975)
root[ERROR]     at get @ lepus.client.internal.ConnectionState$$anon$1.awaitOpened(ConnectionState.scala:107)
root[ERROR]     at get @ lepus.client.internal.ConnectionState$$anon$1.awaitOpened(ConnectionState.scala:107)
root[ERROR]     at flatMap @ fs2.Stream.$anonfun$26(Stream.scala:1975)
root[ERROR]     at get @ lepus.client.internal.ConnectionState$$anon$1.awaitOpened(ConnectionState.scala:107)
root[ERROR]     at complete @ lepus.client.internal.ConnectionState$$anon$1.onClosed(ConnectionState.scala:87)
root[ERROR]     at void @ lepus.client.internal.OutputWriter$$anon$1.onClose(OutputWriter.scala:44)
root[ERROR] Caused by: fs2.interop.scodec.CodecError: expected constant BitVector(8 bits, 0xce) but got BitVector(8 bits, 0x00)
root[ERROR]     at fs2.interop.scodec.CodecError$.apply(CodecError.scala:31)
root[ERROR]     at fs2.interop.scodec.StreamDecoder.loop$1$$anonfun$1(StreamDecoder.scala:102)
root[ERROR]     at fs2.Pull$$anon$1.cont(Pull.scala:149)
root[ERROR]     at fs2.Pull$.fs2$Pull$$$bindBindAux(Pull.scala:748)
root[ERROR]     at fs2.Pull$BindBind.cont(Pull.scala:735)
root[ERROR]     at fs2.Pull$ContP.apply(Pull.scala:683)
root[ERROR]     at fs2.Pull$ContP.apply$(Pull.scala:682)
root[ERROR]     at fs2.Pull$Bind.apply(Pull.scala:691)
root[ERROR]     at fs2.Pull$Bind.apply(Pull.scala:691)
root[ERROR]     at fs2.Pull$UnconsRunR$1.out$$anonfun$2(Pull.scala:1019)
root[ERROR]     at fs2.Pull$.interruptGuard$1$$anonfun$1(Pull.scala:952)
root[ERROR]     at get @ fs2.concurrent.SignallingRef$$anon$4.getAndDiscreteUpdatesImpl(Signal.scala:290)
root[ERROR]     at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
root[ERROR]     at flatMap @ fs2.Pull$.goCloseScope$1$$anonfun$1$$anonfun$3(Pull.scala:1216)
root[ERROR]     at update @ fs2.internal.Scope.releaseChildScope(Scope.scala:227)
root[ERROR]     at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
root[ERROR]     at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
root[ERROR]     at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
root[ERROR]     at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
root[ERROR]     at update @ fs2.internal.Scope.releaseChildScope(Scope.scala:227)
root[ERROR]     at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)
root[ERROR]     at main$ @ com.jmreardon.catsdashboard.Main$.main(Main.scala:10)
root[ERROR]     at flatMap @ fs2.Compiler$Target.flatMap(Compiler.scala:163)

Thank you!
I thought I've handled all the errata, but apparently it wasn't handled.
I just pushed the fix, which will publish a snapshot release soon.

Fixed version is available on v0.1.1

Thanks! Tested and can confirm it is working!