zeromq / zeromq4-1

ZeroMQ 4.1.x stable release branch - bug fixes only
GNU General Public License v3.0
125 stars 137 forks source link

ZeroMQ : 4.2.0 : Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state #175

Open BalajiPolisetty2207 opened 5 years ago

BalajiPolisetty2207 commented 5 years ago

ZeroMQ : 4.2.0 : Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state. we are using ZeroMQ from past 4 years and it is working fine till now as per new standards we have updated our android application to use Clang compiler instead of GCC and ZeroMQ is compiled using GCC still. we are getting above error when we changed to Clang compiler. Can some please share how i can resolve this is blocking our release.

bluca commented 5 years ago

The EFSM error means that the application is violating the strict 1 request - 1 reply pattern with ZMQ_REQ/ZMQ_REP sockets. Is this what's happening?

BalajiPolisetty2207 commented 5 years ago

Before changing the compiler from gcc to clang everything is working upon changing we are seeing the issue.

Logs are coming like this 2019-01-02 16:45:46.384 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:10692/sample/MobileApp" 2019-01-02 16:45:51.317 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:7367/sample/MobileApp" 2019-01-02 16:45:56.354 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:8023/sample/MobileApp" 2019-01-02 16:46:02.093 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:16061/sample/MobileApp" 2019-01-02 16:46:08.071 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:2505/sample/MobileApp" 2019-01-02 16:46:14.354 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:5390/sample/MobileApp" 2019-01-02 16:46:20.223 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:10983/sample/MobileApp" 2019-01-02 16:46:25.924 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:10471/sample/MobileApp" 2019-01-02 16:46:30.601 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:10471/sample/MobileApp" 2019-01-02 16:46:31.829 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:16368/sample/MobileApp" 2019-01-02 16:46:36.565 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:16368/sample/MobileApp" 2019-01-02 16:46:39.531 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:4334/sample/MobileApp" 2019-01-02 16:46:45.220 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:10287/sample/MobileApp" 2019-01-02 16:46:51.049 PID:00000E8A TID:DD9CC920 [MessagingLib] Register application command received, application address="tcp://localhost:19770/sample/MobileApp"

2019-01-02 16:47:25.636 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:47:31.570 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:47:37.255 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:47:43.064 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:47:48.757 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:47:54.442 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:00.134 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:05.821 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:11.512 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:17.198 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:22.871 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:28.551 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:34.227 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:39.904 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:45.586 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:51.269 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:48:56.950 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:02.630 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:08.304 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:13.981 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:19.654 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:25.329 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:31.016 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:36.688 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:42.361 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:48.041 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:53.720 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:49:59.394 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:05.068 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:10.745 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:16.423 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:22.099 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:27.776 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:33.453 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:39.124 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:44.806 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:50.477 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:50:56.151 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:01.822 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:07.500 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:13.173 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:18.854 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:24.526 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:30.206 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:35.886 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:41.566 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:47.251 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:52.923 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:51:58.603 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:04.278 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:09.950 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:15.626 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:21.304 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:26.987 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:32.667 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:38.352 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:44.022 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:49.696 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:52:55.373 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:01.049 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:06.720 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:12.394 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:18.068 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:23.738 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:29.416 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:35.086 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state 2019-01-02 16:53:40.758 PID:00000E8A TID:DDA26920 [MessagingLib] Error detected while waiting for received reply ACK, ZMQ error: 156384763, Operation cannot be accomplished in current state

BalajiPolisetty2207 commented 5 years ago

do we need to build the ZeroMQ with Clang compiler instead of GCC to solve this issue. If yes can you please let us know how we can do this. Really thanks in advance.

bluca commented 5 years ago

The compiler should not be important - again, is the application following the strict request/reply pattern?

BalajiPolisetty2207 commented 5 years ago

This application is developing long before i am not sure how i can check request/reply pattern. Can you please help how i can check this.

bluca commented 5 years ago

A ZMQ_REQ socket must exactly send a message, then receive a message, then send a message, then receive a message, and so on. A ZMQ_REP must to the opposite - receive a message, then send a message, and so on. If this order is not followed, you get the error you are seeing.

BalajiPolisetty2207 commented 5 years ago

I got your point. issue is observed only when we changed the compiler otherwise everything working smooth.

BalajiPolisetty2207 commented 5 years ago

internal void OpenRequestSocket() { if (!Monitor.TryEnter(zmqRequestSocketLock, 20 * 1000)) throw new SkynaxException(API_ERROR_CODE.LOCK_SYNC_OBJECT, MessagingClient.GetErrorText(API_ERROR_CODE.LOCK_SYNC_OBJECT));

        try
        {
            try
            {
                // close existing socket if exists
                if (zmqRequestSocket != null)
                {
                    zmqRequestSocket.Close();
                    zmqRequestSocket = null;
                }
            }
            catch (Exception)
            {
            }

            if( zmqRequestSocket == null )
                // create new socket for send requests to the Skynax client
                zmqRequestSocket = new ZMQ.ZSocket(zmqContext, ZMQ.REQ);

            zmqRequestSocket.SendTimeOut = 3000;        // socket send method will timeout after 3 sec. if send operation fails
            zmqRequestSocket.ReceiveTimeOut = 3000;     // socket receive method will timeout after 3 sec. if no incomming message arrives
            zmqRequestSocket.Linger = 0;                // disable socket linger timeout

            // connect request's socket
            zmqRequestSocket.Connect(CreateAddrOfSystemRequestQueue(true));
        }
        finally
        {
            Monitor.Exit(zmqRequestSocketLock);
        }
    }

we are creating request socket as mentioned above is there any wrong in the above because i am not sure it is creating multiple requests without response received

bluca commented 5 years ago

The socket creation doesn't affect the FSM state, the sending/receiving part should be checked instead

BalajiPolisetty2207 commented 5 years ago

Below is the sample for sendrequest. Please check is there any wrong.

internal void SendMessageToClient(IMessage msg, ZMQ.ZSocket socket, bool replyRequested) { string errorDescr; API_ERROR_CODE errorCode = API_ERROR_CODE.ERROR; XmlMessage receivedMsg; int timeout = 0;

        if (msg.TimeToLive > 0)
        {
            if (msg.TimeToLive > MessageSendTimeout)
                timeout = MessageSendTimeout;
            else
                timeout = msg.TimeToLive;
        }
        else
            timeout = MessageSendTimeout;

        if( ApplicationID.Length < 1 )
            throw new Exception( API_ERROR_CODE.INVALID_MESSAGE_QUEUE_ID, GetErrorText( API_ERROR_CODE.INVALID_MESSAGE_QUEUE_ID ) );

        if( !clientInitialized )
            throw new Exception( API_ERROR_CODE.NOT_INITIALIZED, GetErrorText( API_ERROR_CODE.NOT_INITIALIZED ) );

        if (String.IsNullOrEmpty (msg.To ))
            msg.To = CreateAddrOfAppRequestQueue();
        if (String.IsNullOrEmpty (msg.From ))
            msg.From = CreateAddrOfAppReplyQueue();

        // generated unique message ID before send it
        ((Message)msg).GenerateMessageID();

        // set current send timestamp value
        ((Message)msg).SetSendTimestamp();

        // make XML message
        MemoryStream memoryStream = new MemoryStream();
        errorCode = ((Message)msg).CreateBinaryData (out memoryStream, out errorDescr);
        if( errorCode != API_ERROR_CODE.SUCCESS )
            throw new Exception( errorCode, errorDescr );

        try
        {
            Stopwatch  stopWatch = new Stopwatch();
            stopWatch.Start();

            // send message
            bool sent = false;
            while( !cancelRequested )
            {
                if( stopWatch.Elapsed.TotalSeconds > timeout )
                {
                    throw new Exception( API_ERROR_CODE.TIMEOUT_EXPIRED, GetErrorText( API_ERROR_CODE.TIMEOUT_EXPIRED ) );
                }

                if( !sent  )
                {
                    try
                    {
                        // send message
                        if (socket.Send(memoryStream.ToArray(), 0))
                        {
                            sent = true;
                        }
                        else
                            Thread.Sleep(100);
                    }
                    catch (Java.Lang.RuntimeException javaException)
                    {
                        if (EFSMErrorDetected(javaException))
                        {
                            // an invalid socket state detected, try to reopen request socket
                            throw new Exception(API_ERROR_CODE.INVALID_SOCKET_STATE, GetErrorText(API_ERROR_CODE.INVALID_SOCKET_STATE));
                        }

                        Thread.Sleep(100);
                    }
                    catch (Exception)
                    {
                        Thread.Sleep(100);
                    }
                }

                if( sent )
                {
                    if( !replyRequested )
                        break;

                    byte[] data;

                    try
                    {
                        data = socket.Recv(0);
                    }
                    catch (Exception)
                    {
                        data = null;
                        Thread.Sleep(100);
                    }

                    if (data != null)
                    {
                        if (data.Length == 0)
                        {
                            // "dummy" zero length message received, this message is used by the sender to try to correct invalid socket state on sender's side
                            continue;
                        }

                        String xmlMessage;
                        xmlMessage = Encoding.UTF32.GetString( Encoding.Convert( Encoding.UTF8, Encoding.UTF32, data ) );

                        // check content type
                        String contentType;
                        errorCode = Message.GetContentTypeReceived( xmlMessage, out contentType, out errorDescr );
                        if( errorCode != API_ERROR_CODE.SUCCESS )
                        {
                            // invalid message received
                            continue;
                        }

                        if( String.Equals( contentType, "XmlMessage", StringComparison.OrdinalIgnoreCase ) )
                        {
                            receivedMsg = new XmlMessage();

                            errorCode = receivedMsg.ParseMessage( xmlMessage, out errorDescr );
                            if( errorCode != API_ERROR_CODE.SUCCESS )
                            {
                                // invalid message received
                                receivedMsg = null;
                                continue;
                            }
                        }
                        else
                        {
                            // unimplemented content type received
                            receivedMsg = null;
                            continue;
                        }

                        if (String.Equals(msg.MessageId, receivedMsg.CorrelationId, StringComparison.OrdinalIgnoreCase))
                        {
                            // parse message processing status

                            // parse reply message body
                            MSG_PROCESSING_STATUS  msgProcessingStatus;
                            errorCode = ParseMessageProcessingStatus( receivedMsg.Xml, out msgProcessingStatus, out errorDescr );
                            if( errorCode == API_ERROR_CODE.SUCCESS
                                && msgProcessingStatus.code == (int)API_ERROR_CODE.SUCCESS
                                && msgProcessingStatus.status == MSG_PROCESSING_STATUS.STATUS.QueuedForProcessing )
                            {
                                // message is queued for processing
                                break;
                            }
                            else
                            {
                                if( errorCode != API_ERROR_CODE.SUCCESS )
                                {
                                    // unable to parse message processing status
                                    throw new Exception( errorCode, errorDescr );
                                }
                                else
                                {
                                    // unable to process message in  client
                                    throw new Exception( (API_ERROR_CODE)msgProcessingStatus.code, msgProcessingStatus.description );
                                }
                            }
                        }

                        receivedMsg = null;
                        continue;
                    }
                }
            }
        }
        catch( Exception e )
        {
            throw new Exception (e);
        }
        catch( ZMQException e )
        {
            throw new Exception( API_ERROR_CODE.ZMQ_ERROR, String.Format( GetErrorText( API_ERROR_CODE.ZMQ_ERROR ), e.ErrorCode, e.ToString() ) );
        }
        catch( Exception )
        {
            throw new Exception( API_ERROR_CODE.SEND_MESSAGE, GetErrorText( API_ERROR_CODE.SEND_MESSAGE ) );
        }
    }
bluca commented 5 years ago

From what I can understand (the formatting and indentation are a bit confusing) there are a few times in that loop where it can either continue or break if a receive fails for some reasons (given the socket creation adds a timeout, most likely due to that), which means it will go back to send without receiving. As mentioned multiple times and written in the docs, that's illegal. Also there's:

if( !replyRequested )
    break;

Again, that's not allowed with req/rep.

BalajiPolisetty2207 commented 5 years ago

can you please suggest how i can handle above error case ?

bluca commented 5 years ago

Have a look a the zguide: http://zguide.zeromq.org/

BalajiPolisetty2207 commented 5 years ago

when we trying to build zeromq in linux environment and running make command we are seeing below error.

[exec] ZMQ.cpp:23:28: error: org_zeromq_ZMQ.h: No such file or directory [exec] ZMQ.cpp:25: error: 'JNIEnv' was not declared in this scope [exec] ZMQ.cpp:25: error: 'env' was not declared in this scope [exec] ZMQ.cpp:25: error: 'jobject' was not declared in this scope [exec] ZMQ.cpp:25: error: initializer expression list treated as compound expression [exec] ZMQ.cpp:26: error: expected ',' or ';' before '{' token

Can you please help how i can resolve this. ?

bluca commented 5 years ago

That source file is not from the libzmq repository (and neither is that missing header), so I'm afraid I don't know how to help, sorry

sigiesec commented 5 years ago

Looks like jzmq: https://github.com/zeromq/jzmq

manishsharma13 commented 5 years ago

Please share pointers to compile zeromq using clang.

bluca commented 5 years ago

./configure CC=clang CXX=clang++

manishsharma13 commented 5 years ago

Thanks, it works for x86 clang tool but for arm clang tool gives error. Can zeromq be compiled using clang for arm?

~/temp/zeromq/local/libzmq$ ./configure CC=clang CXX=clang++ checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-safe mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(MAKE)... yes checking whether make supports nested variables... yes checking whether UID '1000' is supported by ustar format... yes checking whether GID '1000' is supported by ustar format... yes checking how to create a ustar tar archive... gnutar checking whether make supports nested variables... (cached) yes checking for gcc... clang checking whether the C compiler works... no configure: error: in `/home/user/temp/zeromq/local/libzmq': configure: error: C compiler cannot create executables

bluca commented 5 years ago

it's just using autotools, so you just need to pass the right parameters that generally autotools requires to do cross compilations