Cannot declare a queue ( Urgent help needed )

146 views
Skip to first unread message

Amir Sepehrom

unread,
May 26, 2018, 9:48:10 AM5/26/18
to rabbitmq-users

Hi everyone,

I recently switched to this library after using the C library for a long time.
I'm trying to write a very basic code on sending and receiving a test message.
According to the documentation on RabbitMQ website a new queue should be declared like this:
RMQQueue *q = [ch queue:@"hello"];

However, after execution of this line the app stops with this error:
[RMQQueueDeclare initWithQueue:options:arguments:]: unrecognized selector sent to instance

This method is called in memoizedQueueDeclare:options:arguments: method inside RMQAllocationChannel.m where RMQMethods+Convenience.h is imported as is implemented inside the Convenience category on RMQQueueDeclare.

The selector is there, the right object is receiving the method, and above all nothing is changed and this code is a part of the pod I installed using Cocoapods. It seems that this problem is a part of the library and I haven't found any open issues or topics related to this.

As the case is too urgent for me, any attentions, ideas, quick fixes or anything is really really appreciated.

Thank you all in advanced.

Michael Klishin

unread,
May 26, 2018, 11:15:24 AM5/26/18
to rabbitm...@googlegroups.com
See server logs. Most likely your channel is closed, possibly due to a [protocol] channel exception. All of those are logged.

Runnable tutorials [1] and Wireshark [2] can be helpful as well. Don't guess, collect data instead.


--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ

Amir Sepehrom

unread,
May 26, 2018, 11:17:43 AM5/26/18
to rabbitm...@googlegroups.com
I guess the problem is in a syntax level. How can a channel cause an “Unrecognized Sector Sent to Instance” error by being open or close? 

On Sat, May 26, 2018 at 7:45 PM Michael Klishin <mkli...@pivotal.io> wrote:
See server logs. Most likely your channel is closed, possibly due to a [protocol] channel exception. All of those are logged.

Runnable tutorials [1] and Wireshark [2] can be helpful as well. Don't guess, collect data instead.

On Sat, May 26, 2018 at 2:48 PM, Amir Sepehrom <amir.s...@gmail.com> wrote:

Hi everyone,

I recently switched to this library after using the C library for a long time.
I'm trying to write a very basic code on sending and receiving a test message.
According to the documentation on RabbitMQ website a new queue should be declared like this:
RMQQueue *q = [ch queue:@"hello"];

However, after execution of this line the app stops with this error:
[RMQQueueDeclare initWithQueue:options:arguments:]: unrecognized selector sent to instance

This method is called in memoizedQueueDeclare:options:arguments: method inside RMQAllocationChannel.m where RMQMethods+Convenience.h is imported as is implemented inside the Convenience category on RMQQueueDeclare.

The selector is there, the right object is receiving the method, and above all nothing is changed and this code is a part of the pod I installed using Cocoapods. It seems that this problem is a part of the library and I haven't found any open issues or topics related to this.

As the case is too urgent for me, any attentions, ideas, quick fixes or anything is really really appreciated.

Thank you all in advanced.

--
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

--
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.

Michael Klishin

unread,
May 26, 2018, 11:23:47 AM5/26/18
to rabbitm...@googlegroups.com
Amir,

I'm sorry but you haven't provided an actual stack trace but you expect members of this list to guess
what is going on. Guessing is too time consuming, please help others help you.

A closed channel can have a nil response or dependent object/delegate, which can sometimes lead to pretty
obscure.

Most "syntax errors" would likely not compile to begin with but you claim that this is a runtime issue.

I already suggested executable tutorials [1] twice (once on GitHub, once in this thread). The most basic
example from tutorial 1 does declare a queue [2].


On Sat, May 26, 2018 at 4:17 PM, Amir Sepehrom <amir.s...@gmail.com> wrote:
I guess the problem is in a syntax level. How can a channel cause an “Unrecognized Sector Sent to Instance” error by being open or close? 
On Sat, May 26, 2018 at 7:45 PM Michael Klishin <mkli...@pivotal.io> wrote:
See server logs. Most likely your channel is closed, possibly due to a [protocol] channel exception. All of those are logged.

Runnable tutorials [1] and Wireshark [2] can be helpful as well. Don't guess, collect data instead.

On Sat, May 26, 2018 at 2:48 PM, Amir Sepehrom <amir.s...@gmail.com> wrote:

Hi everyone,

I recently switched to this library after using the C library for a long time.
I'm trying to write a very basic code on sending and receiving a test message.
According to the documentation on RabbitMQ website a new queue should be declared like this:
RMQQueue *q = [ch queue:@"hello"];

However, after execution of this line the app stops with this error:
[RMQQueueDeclare initWithQueue:options:arguments:]: unrecognized selector sent to instance

This method is called in memoizedQueueDeclare:options:arguments: method inside RMQAllocationChannel.m where RMQMethods+Convenience.h is imported as is implemented inside the Convenience category on RMQQueueDeclare.

The selector is there, the right object is receiving the method, and above all nothing is changed and this code is a part of the pod I installed using Cocoapods. It seems that this problem is a part of the library and I haven't found any open issues or topics related to this.

As the case is too urgent for me, any attentions, ideas, quick fixes or anything is really really appreciated.

Thank you all in advanced.

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
MK

Staff Software Engineer, Pivotal/RabbitMQ

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Amir Sepehrom

unread,
Jun 9, 2018, 10:35:14 AM6/9/18
to rabbitmq-users
Dear Michael,

Thank you for your valuable comments. Here are a couple of informations about the code I'm executing:

According to the tutorial provided in http://www.rabbitmq.com/tutorials/tutorial-one-objectivec.html , a RabbitMQ connection, channel and queue should be declared like this:

RMQConnection *conn = [[RMQConnection alloc] initWithUri:@"amqp://myrabbitserver.com:1234"
                                               
delegate:[RMQConnectionDelegateLogger new]];
id<RMQChannel> ch = [conn createChannel];

RMQQueue *q = [ch queue:@"hello"];

This is the way I have done it in my code:

The header file :

@property (strong, nonatomic) RMQConnection *VBSRMQConnection;

@property (strong, nonatomic) id<RMQChannel> VBSRMQSendChannel;

@property (strong, nonatomic) id<RMQChannel> VBSRMQReceiveChannel;

@property (strong, nonatomic) RMQExchange *VBSRMQExchange;

@property (strong, nonatomic) RMQQueue *VBSRMQQueue;


The implementation file:

self.VBSRMQConnection = [[RMQConnection alloc] initWithUri:[NSString stringWithFormat:@"amqp://%@:%@@%@:%d",

                                                                 RMQ_SERVER_USERNAME, RMQ_SERVER_PASSWORD, RMQ_SERVER_ADDRESS, RMQ_SERVER_PORT]

                                                       delegate:[RMQConnectionDelegateLogger new]];

[self.VBSRMQConnection start];

self.VBSRMQSendChannel = [self.VBSRMQConnection createChannel];

self.VBSRMQReceiveChannel = [self.VBSRMQConnection createChannel];

self.VBSRMQQueue = [self.VBSRMQReceiveChannel queue:[DBManager getSettingForKey:VBSUserPhoneNumber]];


Which seems to be similar to the tutorial provided in the website. However after executing the code, a crash is being occurred when execution reaches to following line :

method = [method initWithQueue:declaredQueueName options:options arguments:arguments];


in this method :

- (RMQQueue *)memoizedQueueDeclare:(NSString *)originalQueueName

                          options:(RMQQueueDeclareOptions)options

                        arguments:(RMQTable *)arguments {


    NSString *declaredQueueName = [originalQueueName isEqualToString:@""]

   ? [self.nameGenerator generateWithPrefix:@"rmq-objc-client.gen-"]

   : originalQueueName;


    if (self.queues[declaredQueueName]) {


        NSError *error = [NSError errorWithDomain:RMQErrorDomain

                                            code:RMQErrorChannelQueueNameCollision

                                        userInfo:@{NSLocalizedDescriptionKey: @"Name collision when generating unique name."}];


        [self.delegate channel:self error:error];

       return nil;


    } else {


        RMQQueue *q = [[RMQQueue alloc] initWithName:declaredQueueName

                                            options:options

                                          arguments:arguments

                                            channel:(id<RMQChannel>)self];


                RMQQueueDeclare *method = [RMQQueueDeclare alloc];

               method = [method initWithQueue:declaredQueueName options:options arguments:arguments];

               [self.dispatcher sendSyncMethod:method];


        self.queues[q.name] = q;

        self.queueBindings[q.name] = [NSMutableSet new];

        return q;


    }


}


With the following error : 

-[RMQQueueDeclare initWithQueue:options:arguments:]: unrecognized selector sent to instance 0x1d0092160


Which seems odd because this means there is no "initWithQueue:options:arguments:" instance method is declared on "RMQQueueDeclare" class, while this method is declared and the container category file which is "RMQMethods+Convenience" is imported in "RMQAllocatedChannel" class where the crash is happening.

Here is also the stack trace when the crash is happening :

0   ???                             0x00000001090ac908 0x0 + 4446669064,

1   RMQApp                          0x0000000100fb2b14 main + 0,

2   CoreFoundation                  0x000000018158c5c8 <redacted> + 1380,

3   CoreFoundation                  0x000000018147241c _CF_forwarding_prep_0 + 92,

4   RMQApp                          0x000000010110e280 -[RMQAllocatedChannel memoizedQueueDeclare:options:arguments:] + 876,

5   RMQApp                          0x0000000101109c8c -[RMQAllocatedChannel queue:options:arguments:] + 328,

6   RMQApp                          0x0000000101109d94 -[RMQAllocatedChannel queue:options:] + 180,

7   RMQApp                          0x0000000101109e14 -[RMQAllocatedChannel queue:] + 76,

8   RMQApp                          0x0000000100ffdcb0 -[ConnectionManager establishConnectionToRabbitMQServer] + 744,

9   RMQApp                          0x0000000100fef414 -[AppDelegate application:didFinishLaunchingWithOptions:] + 924,



BTW, "establishConnectionToRabbitMQServer" method is where the queue creation code is being called.

I hope this set of data can elaborate the situation a bit. Any idea or help is really appreciated.

Thank you very much,

Kind regards,
Amir
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

--
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.

--
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.

Amir Sepehrom

unread,
Jun 11, 2018, 2:15:54 AM6/11/18
to rabbitm...@googlegroups.com
Any ideas or suggestions?

Michael Klishin

unread,
Jun 11, 2018, 2:25:47 AM6/11/18
to rabbitm...@googlegroups.com
Can a modified version of the tutorials that run into this exception be put on GitHub or similar?
I'm not sure what does

[DBManager getSettingForKey:VBSUserPhoneNumber]

return.

Also, I would not expect lightning fast responses to questions posted over the weekend.

Any ideas or suggestions?

To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Amir Sepehrom

unread,
Jun 11, 2018, 2:39:42 AM6/11/18
to rabbitm...@googlegroups.com
Dear Michael, thank you for your time,

Sorry I wasn’t attentive about weekend as weekends are on different days in my country.

Regarding the mentioned method, it just returns an NSString which contains the desired name for the queue which is something like @“989368274639” .

I can put the modified version online or give you remote access if you think it can help, but my guess is that maybe this happens only when the connection is made to our servers not other rabbitmq servers. And since they are not accessible over a public IP address, I think the only way to see it in action, would be having remote access. Do you think if it is possible for you to take a look at it remotely?

Sincerely
Amir

Michael Klishin

unread,
Jun 11, 2018, 1:24:48 PM6/11/18
to rabbitm...@googlegroups.com
 A small self-contained project that can be used to reproduce is all we can ask for.
Of course we expect all sensitive data to be edited out before it is put up on GitHub.

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Amir Sepehrom

unread,
Jun 12, 2018, 1:36:39 PM6/12/18
to rabbitm...@googlegroups.com
Dear Michael,

Thank you for the time you put into this. I finally found the problem. Apparently the original source of this traces back to the installation source. First I fetched the framework over Cocoapods, and then I switched to Carthage and installed it this way. The problem was fixed and my same code seems to be working perfectly. I was curious if this was the actual reason and solution, so I switched back from Carthage to Cocoapods to see if it re-appears and it did. I even checked the files for both states and even the number of header files were different. I have no idea if this is happening to me only or others experience the same using pods, but for now the crash is gone by switching to Carthage without changing anything in my code.

Best,
Amir

Michael Klishin

unread,
Jun 12, 2018, 3:41:40 PM6/12/18
to rabbitm...@googlegroups.com
Thank you for reporting back. So there might have been some stale compilation artifacts
that were used or something of that nature. That might explain why I could not reproduce it.

--
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-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages