Hi, I'm using amazon activemq client. Under debugger crash can be 100% reproduced: Just run it under gdb, making breakpoints in sem_post()/sem_wait() and run a producer for this consumer then.
$ gdb ./brokersession_example_receiver_sync GNU gdb Red Hat Linux (6.3.0.0-1.132.EL4rh) Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/tls/libthread_db.so.1". (gdb) b sem_post Function "sem_post" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 1 (sem_post) pending. (gdb) b sem_wait Function "sem_wait" not defined. Make breakpoint pending on future shared library load? (y or [n]) y Breakpoint 2 (sem_wait) pending. (gdb) r 'tcp://motl-desk:61616' Starting program: /home/motl/trunk/amazon/amq_examples/bs_sync_recv/.libs/brokersession_example_receiver_sync 'tcp://motl-desk:61616' [Thread debugging using libthread_db enabled] [New Thread 182900245984 (LWP 22108)] [New Thread 1084229984 (LWP 22125)] [Switching to Thread 182900245984 (LWP 22108)] Breakpoint 4, 0x000000350710a620 in sem_wait () from /lib64/tls/libpthread.so.0 (gdb) c Continuing. [Switching to Thread 1084229984 (LWP 22125)] Breakpoint 3, 0x000000350710a820 in sem_post () from /lib64/tls/libpthread.so.0 (gdb) c Continuing. Received message: 1 [Switching to Thread 182900245984 (LWP 22108)] Breakpoint 4, 0x000000350710a620 in sem_wait () from /lib64/tls/libpthread.so.0 (gdb) c Continuing. brokersession_example_receiver_sync: BlockingMessageConsumer.cpp:61: virtual std::auto_ptr<ActiveMQ::Message> ActiveMQ::BlockingMessageConsumer::receive(): Assertion `!messages_.empty()' failed. Program received signal SIGABRT, Aborted. 0x000000350662e21d in raise () from /lib64/tls/libc.so.6 (gdb) I've investigated the source code, this could only happen when semaphore is released and there is no messages in the incoming queue for the consumer, but the semaphore is only released when the message is pushed to the queue . It seems that semaphore becomes "released" by some other reason - maybe memory corruption takes place. -- View this message in context: http://www.nabble.com/amazon-activemq-cpp%3A-crash%28assertion-failed%29-while-receiving-a-message-tf2967887.html#a8304787 Sent from the ActiveMQ - Dev mailing list archive at Nabble.com.
