Socket error code 0

socket error code 0

This error cannot be easily reproduced with a single curl command. {"code":4,"message":"Forbidden"}. The request was denied in the allowRequest. 10061 corresponds to the code of the connection refused socket error code in Windows (also known as WSAECONNREFUSED). Title: ATP6100/SWAN: Connect lost: Socket error code 4120 LINE 1 on CPU 0 via TCPIP $ZB01A using TCP/IP via QIO designated PATH B, Connect lost Socket.

Thematic video


Socket error code 0 - that necessary Unrecognized Windows Sockets error: 0: recv failed at Method) at at at at at at at com.rabbitmq.client.impl.Frame.readFrom( at com.rabbitmq.client.impl.SocketFrameHandler.readFrame( at com.rabbitmq.client.impl.AMQConnection$ at 


JDK bug reported on AdoptOpenJDK: 
JDK bug reported on OpenJDK:

The bug is that the Windows socket API WSAGetLastError() is invoked twice before throwing SocketException.

The first invocation captures the original socket error during recv() invocation, late on during the population of SocketException, WSAGetLastError() is invoked again and the 2nd invocation always returns error code 0 as the previous invocation also resets the last socket error code to 0 therefore the original socket error code has been lost during 2nd invocation.


One of the root cause is that long JVM GC procedure pauses the thread of and causes Windows socket recv() timeout.


Please adopt OpenJDK8u272 (or late version) and tune Mule runtime JVM heap settings, the maximum Java heap size needs to be increased if heap size is insufficient.


If you have to use a JDK8 distribution older than OpenJDK8u272, please review and tune Mule runtime JVM heap settings, the maximum Java heap size needs to be increased if heap size is insufficient.
Please also adopt AMQP Connector 1.5.0 or later version which allow explicitly disabling socket timeout on underlay windows socket. This involves the following changes on both RabbitMQ server and Mule Application side:

  1. On RabbitMQ server, enable the following settings tcp_listen_options.keepalive = true heartbeat = 6000 #Note: 6000 can be changed to other number
  2. Set heartbeatTimeout="0" on amqp:connection configuration in the Mule Application <amqp:connection ... heartbeatTimeout="0">
  3. Add the following <amqp:socket-configuration> to <amqp:connection>, and soTimeout has to be 0 with keepAlive enabled <amqp:socket-configuration keepAlive="true" soTimeout="0"/>
    For example: <amqp:config name="amqpConfig2" doc:name="AMQP Config" doc:id="0ddc4cfa-cf05-457a-83a0-9b884c7d3d37"> <amqp:connection host="${amqp.host1}" port="${amqp.port}" virtualHost="${amqp.virtualHost}" username="${amqp.username}" password="${amqp.password}" useTls="true" heartbeatTimeout="0"> <reconnection> <reconnect-forever frequency="5000" /> </reconnection> <tls:context> <tls:trust-store path="${amqp.trustedStorePath}" password="${amqp.trustedStorePassword}" type="jks" /> <tls:key-store type="pkcs12" path="${amqp.keyStorePath}" keyPassword="${amqp.keyStorePassword}" password="${amqp.keyStorePassword}" /> </tls:context> <amqp:socket-configuration keepAlive="true" soTimeout="0"/> <amqp:fallback-addresses> <amqp:fallback-address host="${amqp.host2}" port="${amqp.port}" /> <amqp:fallback-address host="${amqp.host3}" port="${amqp.port}" /> <amqp:fallback-address host="${amqp.host4}" port="${amqp.port}" /> </amqp:fallback-addresses> </amqp:connection> <amqp:consumer-config ackMode="AUTO" numberOfConsumers="${amqp.numberOfConsumers}" /> <amqp:quality-of-service-config prefetchCount="${amqp.prefetchCount}" /> </amqp:config>