[rabbitmq-discuss] SocketException when invoking model.BasicPublish

Scott McFadden scott.kendall.mcfadden at gmail.com
Fri Jun 20 03:39:57 BST 2014


Hello Michael, per your suggestion I put the open connection logic in the
class initializer (it only happens once right after construction).  Getting
the connection works fine.  However basic publish still encounters an
error.  However, the error is slightly different this time around.  I
invoked the java tracing proxy so you can see the wire data.

Client side error when invoking basic publish:

System.ArgumentNullException: String reference not set to an instance of a
String.
Parameter name: s
   at System.Text.Encoding.GetBytes(String s)
   at RabbitMQ.Client.Impl.WireFormatting.WriteShortstr(NetworkBinaryWriter
writer, String val)
   at RabbitMQ.Client.Impl.ContentHeaderPropertyWriter.WriteShortstr(String
val)
   at
RabbitMQ.Client.Framing.v0_9_1.BasicProperties.WritePropertiesTo(ContentHeaderPropertyWriter
writer)
   at RabbitMQ.Client.Impl.ContentHeaderBase.WriteTo(NetworkBinaryWriter
writer, UInt64 bodySize)
   at RabbitMQ.Client.Impl.Command.Transmit(Int32 channelNumber,
ConnectionBase connection)
   at RabbitMQ.Client.Impl.SessionBase.Transmit(Command cmd)
   at RabbitMQ.Client.Impl.ModelBase.ModelSend(MethodBase method,
ContentHeaderBase header, Byte[] body)
   at
RabbitMQ.Client.Framing.Impl.v0_9_1.Model._Private_BasicPublish(String
exchange, String routingKey, Boolean mandatory, Boolean immediate,
IBasicProperties basicProperties, Byte[] body)
   at RabbitMQ.Client.Impl.ModelBase.BasicPublish(String exchange, String
routingKey, Boolean mandatory, Boolean immediate, IBasicProperties
basicProperties, Byte[] body)
   at RabbitMQ.Client.Impl.ModelBase.BasicPublish(String exchange, String
routingKey, Boolean mandatory, IBasicProperties basicProperties, Byte[]
body)
   at RabbitMQ.Client.Impl.ModelBase.BasicPublish(String exchange, String
routingKey, IBasicProperties basicProperties, Byte[] body)


Tracer output:

Usage: Tracer [<listenport> [<connecthost> [<connectport>]]]
   Serially traces connections on the <listenport>, logging
   frames received and passing them to the connect host and port.
Invoked as: Tracer 5672 devtest01 5672
com.rabbitmq.tools.Tracer.WITHHOLD_INBOUND_HEARTBEATS = false
com.rabbitmq.tools.Tracer.WITHHOLD_OUTBOUND_HEARTBEATS = false
com.rabbitmq.tools.Tracer.NO_ASSEMBLE_FRAMES = false
com.rabbitmq.tools.Tracer.NO_DECODE_FRAMES = false
com.rabbitmq.tools.Tracer.SUPPRESS_COMMAND_BODIES = false
1403231368956: <Tracer-0> ch#0 <-
{#method<connection.start>(version-major=0, v
rsion-minor=9, server-properties={product=RabbitMQ,
cluster_name=rabbit at DEVTEST
1.criticaltech.com, information=Licensed under the MPL.  See
http://www.rabbitm
.com/, platform=Erlang/OTP, capabilities={exchange_exchange_bindings=true,
auth
ntication_failure_close=true, consumer_priorities=true,
consumer_cancel_notify=
rue, basic.nack=true, publisher_confirms=true, connection.blocked=true},
copyri
ht=Copyright (C) 2007-2013 GoPivotal, Inc., version=3.3.0},
mechanisms=AMQPLAIN
PLAIN, locales=en_US), null, ""}
1403231368956: <Tracer-0> ch#0 ->
{#method<connection.start-ok>(client-properti
s={product=RabbitMQ, platform=.NET, information=Licensed under the MPL.
 See ht
p://www.rabbitmq.com/, copyright=Copyright (C) 2007-2013 GoPivotal, Inc.,
capab
lities={exchange_exchange_bindings=true, authentication_failure_close=true,
con
umer_cancel_notify=true, basic.nack=true, publisher_confirms=true,
connection.b
ocked=true}, version=3.3.0.0}, mechanism=PLAIN, response= logmanager
rfc1945, l
cale=en_US), null, ""}
1403231369155: <Tracer-0> ch#0 <- {#method<connection.tune>(channel-max=0,
fram
-max=131072, heartbeat=580), null, ""}
1403231369159: <Tracer-0> ch#0 ->
{#method<connection.tune-ok>(channel-max=0, f
ame-max=131072, heartbeat=580), null, ""}
1403231369161: <Tracer-0> ch#0 -> {#method<connection.open>(virtual-host=/,
cap
bilities=, insist=false), null, ""}
1403231369374: <Tracer-0> ch#0 <-
{#method<connection.open-ok>(known-hosts=), n
ll, ""}
1403231383444: <Tracer-0> ch#1 -> {#method<channel.open>(out-of-band=),
null, "
}
1403231383668: <Tracer-0> ch#1 <- {#method<channel.open-ok>(channel-id=),
null,
""}
Exception in thread "Thread-2" com.rabbitmq.client.UnexpectedFrameError:
Receiv
d frame: Frame(type=1, channel=1, 18 bytes of payload), expected type
2Stopped.

        at
com.rabbitmq.client.impl.CommandAssembler.consumeHeaderFrame(Command
ssembler.java:106)
        at
com.rabbitmq.client.impl.CommandAssembler.handleFrame(CommandAssembl
r.java:159)
        at
com.rabbitmq.client.impl.AMQCommand.handleFrame(AMQCommand.java:87)
        at
com.rabbitmq.tools.Tracer$DirectionHandler.doFrame(Tracer.java:331)
        at com.rabbitmq.tools.Tracer$DirectionHandler.run(Tracer.java:343)
        at java.lang.Thread.run(Unknown Source)


Server output

=INFO REPORT==== 19-Jun-2014::21:29:29 ===
accepting AMQP connection <0.646.0> (172.17.9.14:57049 -> 172.17.9.24:5672)

=ERROR REPORT==== 19-Jun-2014::21:29:47 ===
AMQP connection <0.646.0> (running), channel 1 - error:
{amqp_error,unexpected_frame,
            "expected content header for class 60, got non content header
frame instead",
            'basic.publish'}

=INFO REPORT==== 19-Jun-2014::21:29:47 ===
closing AMQP connection <0.646.0> (172.17.9.14:57049 -> 172.17.9.24:5672)


This client code use to work before we had to restore an old VM snapshot of
the RabitMQ server.  We had to re-install / re-configure our RabbitMQ on
the vm image.  Not sure what I have done to foul it up.

Please advise.


thanks

Scott McFadden




On Wed, Jun 18, 2014 at 10:05 PM, Michael Klishin <mklishin at gopivotal.com>
wrote:

>  On 19 June 2014 at 07:02:17, Scott McFadden (
> scott.kendall.mcfadden at gmail.com) wrote:
> > > It makes me think I screwed up the server side configuration
> > when reinstalling.
>
> There is no configuration that can affect framing/frame interleaving in
> the client.
> This is also the kind of issues that we'd see reported constantly if it
> was a client
> issue. Finally, it happens on a brand new connection.
>
> I'd recommend doing two things:
>
>  * Running a tracer proxy in front of RabbitMQ [1] to see what's being
> sent on the wire
>  * Open a connection on app start if you can instead of opening a new one
> per channel
>
> If the latter does not change anything, please post the output of the
> tracer.
>
> 1. http://www.rabbitmq.com/java-tools.html, see Tracer
> --
> MK
>
> Software Engineer, Pivotal/RabbitMQ
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20140619/b927aeec/attachment.html>


More information about the rabbitmq-discuss mailing list