Re: proton 0.10 and swiftmq router

2015-10-07 Thread serega
If you do not need sasl you can disable it 
see property sasl-enabled on this page
http://www.swiftmq.com/products/router/swiftlets/sys_amqp/config/index.html





--
View this message in context: 
http://qpid.2158936.n2.nabble.com/proton-0-10-and-swiftmq-router-tp7631721p7631970.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Assertion `messenger->distributed' failed

2015-09-28 Thread serega
Hello. 
I posted this question to qpid-users, but I didn't get any reply, so I am
trying my luck on this sub forum. 

My requirement is to immediately accept/acknowledge the received message and
send the ack to the sender, which in my case SwiftMQ AMQP server 

Here is what I am roughly doing.. 

pn_messenger_get(messenger, message); 
pn_tracker_t tracker = pn_messenger_incoming_tracker(messenger); 
pn_messenger_accept(messenger, tracker, 0); 
pn_messenger_work(messenger, 0);   

Without the last line the sender does not get the ack immediately. With that
line in place everything works, but I get often crashes on assertion 

qpid-proton-0.10/proton-c/src/messenger/messenger.c:1022: pni_pump_in:
Assertion `messenger->distributed' failed. 

which asserts that messenger->distributed is greater than zero. 

Am I doing something I shouldn't. Is there any other way to send the ack to
the sender immediately? 

Sergey. 




--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Assertion-messenger-distributed-failed-tp7631375.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: Quotes in the message body

2014-03-28 Thread serega
Thanks for the explanation. Yes, I used recv client. 

I had to also call pn_data_next(body) to make it work, so it looks like so 
--
pn_data_t *body = pn_message_body(message);
pn_data_next(body);
pn_bytes_t bytes =  pn_data_get_string(body);
--

The Qpid Proton needs more documentation and/or example code. The
messenger.h is very well documented, but I couldn't find any documentation
on how to read and write data (properties, body) from and to a message.  

Sergey



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Quotes-in-the-message-body-tp7606053p7606167.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Quotes in the message body

2014-03-26 Thread serega
I am using Qpid Proton Messenger with SwiftMQ JMS/AMQP broker.  On the
receiving side the messenger surrounds message body with quotes.
smeldris@labitpf2:~/qpid-proton-0.6/build/proton-c/examples/messenger/c./send
-a  amqp://10.250.0.127:5672/testqueue
Message_without_quotessmeldris@labitpf2:~/qpid-proton-0.6/build/proton-c/examples/messenger/csmeldris@labitpf2:~/qpid-proton-0.6/build/proton-c/examples/messenger/c./recv
 
amqp://10.250.0.127:5672/testqueueAddress:
amqp://10.250.0.127:5672/testqueueSubject: (no subject)Content:
Message_without_quotes
Notice the '' character on both sides of the body. The SwiftMQ is JMS
broker which gives me more options to test. Receiving this message using JMS
API yields a message body without quotes, so it clearly happens on the
quid-proton receiving side.   I am stripping out the quotes, but I prefer to
receive the original message without quotes.   - Sergey



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Quotes-in-the-message-body-tp7606053.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.

Re: Qpid Proton messenger on 32 bit linux

2014-02-10 Thread serega
I use Proton with SwiftMQ broker which by default advertises
max-frame-size=2147483647. Then realloc fails to allocate a memory region
inside  pn_buffer_ensure( disp-frame, disp-remote_max_frame) followed by a
crash when disp-frame is used. Fortunately max-frame-size is configurable
in SwiftMQ. I changed it to 65536 and Proton works now. 




--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-messenger-on-32-bit-linux-tp7603445p7604255.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: Qpid Proton messenger on 32 bit linux

2014-01-30 Thread serega
I tried that option and it still crashes.

Sergey



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-messenger-on-32-bit-linux-tp7603445p7603614.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: Qpid Proton messenger on 32 bit linux

2014-01-29 Thread serega
The attached example is a  send.c
http://qpid.2158936.n2.nabble.com/file/n7603555/send.c   slightly modified
send.c example. It works in 64 bit environment, but crashes when proton is
build with export CFLAGS=-m32  . Can you execute it on 32 bit linux? 

Thanks,
Sergey.



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-messenger-on-32-bit-linux-tp7603445p7603555.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: Qpid Proton messenger on 32 bit linux

2014-01-28 Thread serega
I am building on 64 bit RedHat 6.3 that has required 32 bit libraries. It
happens when initiated from both pn_messenger_recv() and
pn_messenger_send().



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-messenger-on-32-bit-linux-tp7603445p7603475.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: Qpid Proton messenger on 32 bit linux

2014-01-28 Thread serega
Do I need to pass any special arguments to cmake or change CMakeLists.txt
that may affect Messanger?



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-messenger-on-32-bit-linux-tp7603445p7603477.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Qpid Proton messenger on 32 bit linux

2014-01-27 Thread serega
Does the messenger work on 32 bit linux? I build the 32 bit messenger by
setting the variable 
export CFLAGS=-m32

The same code that works on 64 bit linux crates on 32.  It always crashes in
pn_encoder_writef8
Here is the crash stack trace from a core dump

Core was generated by `./testconsumer 10.250.0.126 10.250.0.127 1000'.
Program terminated with signal 11, Segmentation fault.
#0  0x00d89877 in pn_encoder_writef8 () from
/usr/local/lib/libqpid-proton.so.2
Missing separate debuginfos, use: debuginfo-install
glibc-2.12-1.80.el6_3.7.i686 libuuid-2.17.2-12.7.el6_3.i686
(gdb) bt
#0  0x00d89877 in pn_encoder_writef8 () from
/usr/local/lib/libqpid-proton.so.2
#1  0x00d89d4c in pni_encoder_enter () from
/usr/local/lib/libqpid-proton.so.2
#2  0x00d85d66 in pni_data_traverse () from
/usr/local/lib/libqpid-proton.so.2
#3  0x00d8a6e5 in pn_encoder_encode () from
/usr/local/lib/libqpid-proton.so.2
#4  0x00d863ec in pn_data_encode () from /usr/local/lib/libqpid-proton.so.2
#5  0x00d8af95 in pn_post_frame () from /usr/local/lib/libqpid-proton.so.2
#6  0x00d930f7 in pn_flush_disp () from /usr/local/lib/libqpid-proton.so.2
#7  0x00d93971 in pn_process_flush_disp () from
/usr/local/lib/libqpid-proton.so.2
#8  0x00d93f94 in pn_phase () from /usr/local/lib/libqpid-proton.so.2
#9  0x00d940c0 in pn_process () from /usr/local/lib/libqpid-proton.so.2
#10 0x00d942e2 in pn_output_write_amqp () from
/usr/local/lib/libqpid-proton.so.2
#11 0x00d94a28 in pn_io_layer_output_passthru () from
/usr/local/lib/libqpid-proton.so.2
#12 0x00d94a28 in pn_io_layer_output_passthru () from
/usr/local/lib/libqpid-proton.so.2
#13 0x00d944cd in transport_produce () from
/usr/local/lib/libqpid-proton.so.2
#14 0x00d94de7 in pn_transport_pending () from
/usr/local/lib/libqpid-proton.so.2
#15 0x00da0726 in pn_connector_process () from
/usr/local/lib/libqpid-proton.so.2
#16 0x00d9b1bf in pn_messenger_tsync () from
/usr/local/lib/libqpid-proton.so.2
#17 0x00d9b503 in pn_messenger_sync () from
/usr/local/lib/libqpid-proton.so.2
#18 0x00d9d279 in pn_messenger_recv () from
/usr/local/lib/libqpid-proton.so.2
#19 0x0065f10c in run_consumer (args=0x8dc7198) at messageconsumer.c:104
#20 0x0050fa49 in start_thread () from /lib/libpthread.so.0
#21 0x0035863e in clone () from /lib/libc.so.6
(gdb) 




--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-messenger-on-32-bit-linux-tp7603445.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: Qpid Proton messenger on 32 bit linux

2014-01-27 Thread serega
I create pthreads, and each thread uses its own messenger, so there is no
sharing and no mutexes. The program works however when there is only 1
thread, but crashes immediately when there is mo than one thread.  It works
in 64 bit mode no matter how many threads I create, but I have to use it in
32 bit environment. 


Debug build shows that encoder-position is NULL.
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xf7feeb70 (LWP 4661)]
0x0012f877 in pn_encoder_writef8 (encoder=0xf6a0b278, value=0 '\000') at
/var/home/smeldris/qpid-proton-0.6/proton-c/src/codec/encoder.c:149
149 encoder-position[0] = value;
Missing separate debuginfos, use: debuginfo-install
glibc-2.12-1.80.el6_3.7.i686 libuuid-2.17.2-12.7.el6_3.i686
(gdb) p encoder-position
$1 = 0x0
(gdb) p encoder
$2 = (pn_encoder_t *) 0xf6a0b278
(gdb) p encoder-size
$3 = 2147483648
(gdb) p encoder-output
$4 = 0x0






--
View this message in context: 
http://qpid.2158936.n2.nabble.com/Qpid-Proton-messenger-on-32-bit-linux-tp7603445p7603468.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


call pn_messenger_accept from another thread

2014-01-17 Thread serega
There are several discussions on this forum regarding multi-threading, and as
I understand messenger isn't thread safe.  However, my use case is simple. 
A single thread receives messages, but message processing is handed over to
another thread

Is it possible to call pn_messenger_accept(messenger, tracker, 0) from
another thread?

- Sergey



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/call-pn-messenger-accept-from-another-thread-tp7602918.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: call pn_messenger_accept from another thread

2014-01-17 Thread serega
Thanks for the answer. Yes, I do have thread safe queue, so I might just
follow your suggestion and set up a reverse queue for trackers.

Sergey.



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/call-pn-messenger-accept-from-another-thread-tp7602918p7602948.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: SASL / proton-c questions

2014-01-14 Thread serega
Andreas, are you planning to fix the bug in the future version?

Thanks,
Sergejs.



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/SASL-proton-c-questions-tp7602690p7602711.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: pn_messenger_send return code

2014-01-12 Thread serega
A related question regarding subscription API. There are several use cases. 
A single subscription to invalid queue on a running broker, the messenger is
blocking
  pn_messenger_subscribe(messenger,
amqp://guest:guest@127.0.0.1:5772/testqueue2);
  pn_messenger_rewrite(messenger, amqp://%/*, $2);
  pn_messenger_set_incoming_window(messenger, 200);
  pn_messenger_set_blocking(messenger, 1);
  for(;;) {
  {
int ret = pn_messenger_recv(messenger, -1);
printf(after receive ret=%d\n, ret);
...
program prints 
LINK ERROR (amqp:not-found) Neither a queue nor a topic is defined with that
name: testqueue2
and waits.

If I set it non blocking program prints
after receive ret=-9
after receive ret=-9
LINK ERROR (amqp:not-found) Neither a queue nor a topic is defined with that
name: testqueue2
after receive ret=-9
after receive ret=-9
...


The same code but with valid queue and no messages in it 
pn_messenger_subscribe(messenger,
amqp://guest:guest@127.0.0.1:5772/testqueue);
also returns -9.
after receive ret=-9
after receive ret=-9
...



Another use case is two subscriptions, one is valid the second is dead,
messenger is blocking.
.
read: Connection refused
[0x100200640]:ERROR[-2] SASL header mismatch: ''

send: Broken pipe
CONNECTION ERROR connection aborted
..

There is an error message printed, but I don't see any way to get that error
programmatically in my client code.  I also brought the broker up and sent
messages to the queue, but the messenger didn't pick them up. I assume there
is no any recovery logic in the messenger itself.  If I bring the second
broker down the pn_messenger_recv returns immediately with error code
PN_STATE_ERR (-5). 


I understand that intent of the messenger is simple API and hiding all
connection management, but there has to be either recovery logic built in or
a way to communicate all errors to the client so it can take appropriate
actions. I do test edge cases which aren't frequent, but they do happen.  






--
View this message in context: 
http://qpid.2158936.n2.nabble.com/pn-messenger-send-return-code-tp7602570p7602623.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: pn_messenger_send return code

2014-01-11 Thread serega
I didn't insert the line in the code as was suggested by Rafael
pn_messenger_set_outgoing_window(messenger, N);

With that change I get PN_STATUS_ABORTED = 6 when the link is broken.

I do have another problem though. I get the following errors sometimes..

./send -a  amqp://guest:guest@127.0.0.1:5672/testqueue
[0x7fdf48700a10]:ERROR[-2] SASL header mismatch:
'\x00\x00\x00\x17\x02\x01\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00D\xc0\x03\x01P\x00AMQP\x03\x01\x00\x00\x00\x00\x00B\x02\x01\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00@\xc0.\x01\xe0+\x05\xa3\x04NTLM\x05PLAIN\x09ANONYMOUS\x0aDIGEST-MD5\x08CRAM-MD5'


sergey:Debug sergey$ for i in {1..5000} ; do  ./send -a 
amqp://guest:guest@127.0.0.1:5672/testqueue; done
[0x7fb0c1406670]:ERROR[-2] SASL header mismatch:
'\x00\x00\x00\x17\x02\x01\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00D\xc0\x03\x01P\x00AMQP\x03\x01\x00\x00\x00\x00\x00B\x02\x01\x00\x00\x00\x80\x00\x00\x00\x00\x00\x00\x00@\xc0.\x01\xe0+\x05\xa3\x0aDIGEST-MD5\x08CRAM-MD5\x04NTLM\x05PLAIN\x09ANONYMOUS'


The client simply hangs after reporting this error. I stepped in debugger
and found that the call doesn't return from  pn_driver_wait(). 




--
View this message in context: 
http://qpid.2158936.n2.nabble.com/pn-messenger-send-return-code-tp7602570p7602616.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


pn_messenger_send return code

2014-01-10 Thread serega
Hello. I am evaluating Qpid Proton AMQP Messenger  to communicate with
SwiftMQ broker. I've had issues with receiving messages, but I used
suggestion  here https://issues.apache.org/jira/browse/PROTON-484   and it
solved the problem.  The use case I am testing is broker is down. Modified
send.c code:

 int res = pn_messenger_put(messenger, message);
 printf(Error %d\n, res);
 check(messenger);
 res = pn_messenger_send(messenger, -1);
 printf(Error %d\n, res);
 check(messenger);


The output:
__
Error 0
read: Connection refused
[0x101009c00:0] ERROR[-2] SASL header mismatch: ''
send: Broken pipe
CONNECTION ERROR connection aborted
Error 0
__


Shouldn't there be a non zero error code as documented in messenger.h ? 
* @return an error code or zero on success
 * @see error.h
 */
PN_EXTERN int pn_messenger_send(pn_messenger_t *messenger, int n);


Thanks,
Sergey.



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/pn-messenger-send-return-code-tp7602570.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.


Re: pn_messenger_send return code

2014-01-10 Thread serega
Thanks for your reply. I added the tracker, but with the same scenario it
returns 0 which is PN_STATUS_UNKNOWN = 0.
-
Error 0
read: Connection refused
[0x100810800:0] ERROR[-2] SASL header mismatch: ''
send: Broken pipe
CONNECTION ERROR connection aborted
Error 0
Status off M1: 0
---
It looks like internally messenger prints error messages, but it doesn't
communicate with the client about the error. The unknown status isn't very
meaningful. 

Sergey.



--
View this message in context: 
http://qpid.2158936.n2.nabble.com/pn-messenger-send-return-code-tp7602570p7602587.html
Sent from the Apache Qpid Proton mailing list archive at Nabble.com.