An operation was attempted on something that is not a socket

628 views
Skip to first unread message

Patrick Histon

unread,
Jul 13, 2016, 7:08:52 AM7/13/16
to rabbitmq-users
Hi, we're using EasyNetQ .NET API which utilises RabbitMQ.

EasyNetQ client version: 0.28.3.229
RabbitMQ client version: 3.2.4.0
RabbitMQ version: 3.3.4

Our ASP.NET application pool crashes at seemingly random intervals. We're not sure where in our application code the problem originates, but we see the following in our windows event log.
It seems the API is starting a separate thread and this thread throws an exception which is unhandled by our application.

An unhandled exception occurred and the process was terminated. 
Application ID: /LM/W3SVC/11/ROOT  
Process ID: 22040  
Exception: System.Net.Sockets.SocketException 
Message: An operation was attempted on something that is not a socket  
StackTrace: 

at System.Net.Sockets.Socket.setLingerOption(LingerOption lref)
at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel optionLevel, SocketOptionName optionName, Object optionValue) 
at RabbitMQ.Client.Impl.SocketFrameHandler_0_9.Close() at RabbitMQ.Client.Impl.ConnectionBase.MainLoop() 
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()

Any advice would be greatly appreciated.

Michael Klishin

unread,
Jul 13, 2016, 7:31:22 AM7/13/16
to rabbitm...@googlegroups.com
What that really means is "a socket was in a state where it cannot be used", e.g. closed
by a peer or failed to initialize because the system is out of sockets.

See server logs around the same time: do they indicate clean or abrupt client connection closure?

Also, you may want to use a newer client version, such as 3.6.3. It's not required to upgrade the server
in lock step.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Karl Nilsson

unread,
Jul 13, 2016, 7:38:27 AM7/13/16
to rabbitm...@googlegroups.com
Hi,

I have seen many socket exceptions but never that one. :) The only resource I could find is this SO reply by Hans Passant that suggest it may be an environmental issue: http://stackoverflow.com/questions/17301666/socket-issue-when-trying-to-invoke-remote-object-in-c-sharp

Cheers
Karl

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Karl Nilsson

Staff Software Engineer, Pivotal/RabbitMQ

Patrick Histon

unread,
Jul 13, 2016, 9:39:42 AM7/13/16
to rabbitmq-users
Thank you for your help.

Is it possible the error text is wrong, and it's actually a blocking connection notification, as mentioned here?

Karl Nilsson

unread,
Jul 13, 2016, 9:49:15 AM7/13/16
to rabbitm...@googlegroups.com
It's unlikely to be an exception thrown by the RabbitMQ library itself as that exception message does not occur anywhere in the source code but it could be a windows or .NET or ASP.NET issue.

Cheers
Karl

Michael Klishin

unread,
Jul 13, 2016, 9:58:15 AM7/13/16
to rabbitm...@googlegroups.com, Karl Nilsson
According to the stack trace, it comes from

System.Net.Sockets.Socket.setLingerOption(LingerOption lref)

which is a standard library method. Sure, it is invoked by the RabbitMQ .nET client but
the client doesn't try to assert on the socket state. 

On 13 July 2016 at 16:49:16, Karl Nilsson (knil...@pivotal.io) wrote:
> It's unlikely to be an exception thrown by the RabbitMQ library itself as
> that exception message does not occur anywhere in the source code but it
> could be a windows or .NET or ASP.NET issue.
>
> Cheers
> Karl
>
> On 13 July 2016 at 14:39, Patrick Histon wrote:
>
> > Thank you for your help.
> >
> > Is it possible the error text is wrong, and it's actually a blocking
> > connection notification, as mentioned here?
> >
> > http://stackoverflow.com/questions/22281644/pika-blockingconnection-throwing-wrong-exception-on-windows
> >
> > On Wednesday, 13 July 2016 12:31:22 UTC+1, Michael Klishin wrote:
> >>
> >> What that really means is "a socket was in a state where it cannot be
> >> used", e.g. closed
> >> by a peer or failed to initialize because the system is out of sockets.
> >>
> >> See server logs around the same time: do they indicate clean or abrupt
> >> client connection closure?
> >>
> >> Also, you may want to use a newer client version, such as 3.6.3. It's not
> >> required to upgrade the server
> >> in lock step.
> >>
> >> On Wed, Jul 13, 2016 at 2:08 PM, Patrick Histon
> To post to this group, send an email to rabbitm...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages