SDK Notice while trying to connect to a Solace C API session

Pablo Rodrigues
Pablo Rodrigues Member Posts: 3
edited November 2022 in General Discussions #1

Hello everyone,

After trying to connect to a session using Solace C API, I get the following output:

SDK NOTICE Thu Nov 24 08:16:34.688 2022 solClientSmf.c:7215  (7f0ddd9a2700) Read failed from transport 'TCP' of session '(c4,s1)_od_fo_prod' due to 'Peer closed socket, fd 27, cannot read', client name '(ommited)', VPN name 'od_fo_prod', peer address 'hostname '172.28.124.40:10986' IP 172.28.124.40:10986', connection 'tcp_TxRx' local address 'IP X.X.X.X:45662'.

Anyone knows why am I getting this output? In my tests, some sessions are successfully created and the request are responded as it is expected. However, sometimes the attempt to connect to a session fails at the first time, then this behavior shows up. After that Solace API try to do a number of retries attempts as indicated in SOLCLIENT_SESSION_PROP_CONNECT_RETRIES but the same behavior occurs.

Thanks for your help.

Answers

  • TomF
    TomF Member, Employee Posts: 406 Solace Employee

    Hi @Pablo Rodrigues,

    It looks like the broker end is closing the connection (Peer closed socket). Does the session connect at all, or is this the first error that you see? Is it possible that you've opened too many connections to the broker in your test harness?

  • Pablo Rodrigues
    Pablo Rodrigues Member Posts: 3
    edited November 2022 #3

    Hi @TomF,

    Yes, it seems to me the broker is closing the connection as well, but I do not know the real reason for it. The error shows up right after the set of log messages below:

    SDK INFO Thu Nov 24 08:16:34.687 2022 solClientSocket.c:136 (7f0ddd9a2700) Local connection address 'IP x.x.x.x:45662' for fd 27, session '(c4,s1)_od_fo_prod'
    SDK INFO Thu Nov 24 08:16:34.687 2022 solClientSocket.c:685  (7f0ddd9a2700) _solClient_socket_registerForFdEvents, fd 27, events 2, callback '0x7f0de7277570', user data '0x7f0dd006d4c0' for session '(c4,s1)_od_fo_prod'
    SDK INFO Thu Nov 24 08:16:34.687 2022 solClientSocket.c:764 (7f0ddd9a2700) _solClient_socket_unregisterForFdEvents, fd 27, events 2 for session '(c4,s1)_od_fo_prod'
    SDK INFO Thu Nov 24 08:16:34.687 2022 solClientSocket.c:685 (7f0ddd9a2700) _solClient_socket_registerForFdEvents, fd 27, events 1, callback '0x7f0de7277570', user data '0x7f0dd006d4c0' for session '(c4,s1)_od_fo_prod'
    SDK INFO Thu Nov 24 08:16:34.688 2022 solClientOS.c:5758 (7f0ddd9a2700) Peer closed socket, fd 27, cannot read
    

    I have notice when the connection is successfully established at all the following message after the SDK INFO indicating _solClient_socket_registerForFdEvents is the one informing "Information reported by peer for session '(c1,s1)_od_fo_prod': version = '9.9.0.23'; date = 'Apr 29 2021 16:43:20'; platform = 'Solace PubSub+ 3560'...".

    In the worst scenario I am calling solClient_session_connect() each 15 seconds.

    SOLCLIENT_SESSION_PROP_CONNECT_RETRIES is set to "3" and SOLCLIENT_SESSION_PROP_RECONNECT_RETRY_WAIT_MS is set to default value (3000ms). In fact, I have this behavior always after connect to the broker a few times. Seems to me the window of 15 seconds to make the calls is time enough to be able to connect again to the broker. If it is not, do you know what is the minimum wait time between the requests?

    Thanks, Tom.

  • TomF
    TomF Member, Employee Posts: 406 Solace Employee

    Hi @Pablo Rodrigues,

    If there was an authentication or limits problem on the broker, the connection would initially succeed and an exception would be generated with a reason. This isn't happening, which makes me think this is something in the network layer. Is there any kind of proxy or firewall in the path? That might be running out of connections and closing the connection before it even reaches the broker.

  • Pablo Rodrigues
    Pablo Rodrigues Member Posts: 3

    Hi @TomF,

    As we know there is not any connection limitation in that sense. Looking at the log file generated by the Solace API the only information we see is that 'Peer closed the socket, fd 27, cannot read'. At the moment, we successfully establish four session connections with a time space of 30 seconds between them. However, if we want to establish more than four sessions we just got that socket error. We are trying to make those connections with a exchange snapshot service with Solace as intermediary agent. May you explain more how the access to this service works? Is the service hosted by Solace or the traffic is just being forwarded to the exchange?