Thread: [Quickfix-developers] problem when message.setField method is called
Brought to you by:
orenmnero
From: Brian H. <bh...@pe...> - 2009-12-09 17:54:20
|
Hi, If I modify a FIX message by calling the setField method, I get a segmentation fault when the destructor of the FIX message is called. I am using the latest QuickFIX, Ubuntu 4.1.2-16, and gcc 4.1.3. I have debugged and searched everywhere, but can't find a solution. Any help would be appreciated. Please see below for details. Thank you, Brian #################################### My Program #################################### void testMessage() { cout << "Creating message..." << endl; FIX::Message message; cout << "Adding field..." << endl; message.setField(35, "A"); // message.setField(FIX::MsgType("A")); // it doesn't matter which way I set the field // message.setField(55, "IBM"); // it doesn't matter which field I set } int main(int argc, const char *argv[]) { testMessage(); return 0; } #################################### GDB Output #################################### (gdb) run Starting program: /home/user/workspace/Client/Debug/Client [Thread debugging using libthread_db enabled] [New Thread -1213826560 (LWP 12088)] Creating message... Adding field... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1213826560 (LWP 12088)] 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 (gdb) backtrace #0 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 #1 0xb7e6083c in __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<int const, FIX::FieldBase> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbfba0dfc, __p=0x8053230, __n=1) at /usr/include/c++/4.1.3/ext/mt_allocator.h:721 #2 0xb7e60938 in std::_Rb_tree<int, std::pair<int const, FIX::FieldBase>, std::_Select1st<std::pair<int const, FIX::FieldBase> >, FIX::message_order, __gnu_cxx::__mt_alloc<std::pair<int const, FIX::FieldBase>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_erase (this=0xbfba0dfc, __x=0x8053230) at /usr/include/c++/4.1.3/bits/stl_tree.h:362 #3 0xb7eb75c9 in FIX::FieldMap::clear (this=0xbfba0df8) at /usr/include/c++/4.1.3/bits/stl_tree.h:692 #4 0xb7eb76a0 in ~FieldMap (this=0xbfba0df8) at FieldMap.cpp:35 #5 0x0804b3a5 in ~Message (this=0xbfba0df8) at /home/user/quickfix/include/quickfix/Message.h:57 #6 0x0804a535 in testMessage () at ../Main.cpp:24 #7 0x0804a5bb in main (argc=8, argv=0xbfba1264) at ../Main.cpp:30 #################################### FieldMap.cpp - WHERE I THINK THE PROBLEM IS #################################### The destructor gets called: --------------------------- FieldMap::~FieldMap() { QF_STACK_IGNORE_BEGIN clear(); QF_STACK_IGNORE_END } The clear method gets called: ----------------------------- void FieldMap::clear() { QF_STACK_PUSH(FieldMap::clear) m_fields.clear(); // ####### The clear method is called on an stl::multimap and this is where the seg fault occurs Groups::iterator i; for ( i = m_groups.begin(); i != m_groups.end(); ++i ) { std::vector < FieldMap* > ::iterator j; for ( j = i->second.begin(); j != i->second.end(); ++j ) delete *j; } m_groups.clear(); QF_STACK_POP } STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. |
From: Mikhail V. <mve...@gm...> - 2009-12-10 12:56:20
|
You may want to consider using specific message class defined rather then using the underlying base. - Regards, Mikhail Veygman -----Original Message----- From: Brian Hill <bh...@pe...> To: qui...@li... <qui...@li...> Subject: [Quickfix-developers] problem when message.setField method is called Date: Wed, 9 Dec 2009 11:54:02 -0600 QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Hi, If I modify a FIX message by calling the setField method, I get a segmentation fault when the destructor of the FIX message is called. I am using the latest QuickFIX, Ubuntu 4.1.2-16, and gcc 4.1.3. I have debugged and searched everywhere, but can't find a solution. Any help would be appreciated. Please see below for details. Thank you, Brian #################################### My Program #################################### void testMessage() { cout << "Creating message..." << endl; FIX::Message message; cout << "Adding field..." << endl; message.setField(35, "A"); // message.setField(FIX::MsgType("A")); // it doesn't matter which way I set the field // message.setField(55, "IBM"); // it doesn't matter which field I set } int main(int argc, const char *argv[]) { testMessage(); return 0; } #################################### GDB Output #################################### (gdb) run Starting program: /home/user/workspace/Client/Debug/Client [Thread debugging using libthread_db enabled] [New Thread -1213826560 (LWP 12088)] Creating message... Adding field... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1213826560 (LWP 12088)] 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 (gdb) backtrace #0 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 #1 0xb7e6083c in __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<int const, FIX::FieldBase> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbfba0dfc, __p=0x8053230, __n=1) at /usr/include/c++/4.1.3/ext/mt_allocator.h:721 #2 0xb7e60938 in std::_Rb_tree<int, std::pair<int const, FIX::FieldBase>, std::_Select1st<std::pair<int const, FIX::FieldBase> >, FIX::message_order, __gnu_cxx::__mt_alloc<std::pair<int const, FIX::FieldBase>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_erase (this=0xbfba0dfc, __x=0x8053230) at /usr/include/c++/4.1.3/bits/stl_tree.h:362 #3 0xb7eb75c9 in FIX::FieldMap::clear (this=0xbfba0df8) at /usr/include/c++/4.1.3/bits/stl_tree.h:692 #4 0xb7eb76a0 in ~FieldMap (this=0xbfba0df8) at FieldMap.cpp:35 #5 0x0804b3a5 in ~Message (this=0xbfba0df8) at /home/user/quickfix/include/quickfix/Message.h:57 #6 0x0804a535 in testMessage () at ../Main.cpp:24 #7 0x0804a5bb in main (argc=8, argv=0xbfba1264) at ../Main.cpp:30 #################################### FieldMap.cpp - WHERE I THINK THE PROBLEM IS #################################### The destructor gets called: --------------------------- FieldMap::~FieldMap() { QF_STACK_IGNORE_BEGIN clear(); QF_STACK_IGNORE_END } The clear method gets called: ----------------------------- void FieldMap::clear() { QF_STACK_PUSH(FieldMap::clear) m_fields.clear(); // ####### The clear method is called on an stl::multimap and this is where the seg fault occurs Groups::iterator i; for ( i = m_groups.begin(); i != m_groups.end(); ++i ) { std::vector < FieldMap* > ::iterator j; for ( j = i->second.begin(); j != i->second.end(); ++j ) delete *j; } m_groups.clear(); QF_STACK_POP } STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers |
From: Brian H. <bh...@pe...> - 2009-12-10 15:11:52
|
The same problem also occurs when a specific message class is used (i.e. FIX42::NewOrderSingle, etc). I first encountered this problem when I was trying to add a Password field to a Logon message in the toAdmin callback. void TradingApp::toAdmin(FIX::Message& message, const FIX::SessionID& sessionId) { if (message.getHeader().getField(35) == "A") { message.setField(554, "passwordvalue"); //message.setField(FIX::Password("passwordvalue"); // problem occurs either way I try to set the field } } When the destructor on this FIX message was called, the same seg fault occurred. I get this error any time I try to modify or add a field to a FIX message. Thanks in advance Brian -----Original Message----- From: Mikhail Veygman [mailto:mve...@gm...] Sent: Thursday, December 10, 2009 6:56 AM To: Brian Hill Cc: qui...@li... Subject: Re: [Quickfix-developers] problem when message.setField method is called You may want to consider using specific message class defined rather then using the underlying base. - Regards, Mikhail Veygman -----Original Message----- From: Brian Hill <bh...@pe...> To: qui...@li... <qui...@li...> Subject: [Quickfix-developers] problem when message.setField method is called Date: Wed, 9 Dec 2009 11:54:02 -0600 QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Hi, If I modify a FIX message by calling the setField method, I get a segmentation fault when the destructor of the FIX message is called. I am using the latest QuickFIX, Ubuntu 4.1.2-16, and gcc 4.1.3. I have debugged and searched everywhere, but can't find a solution. Any help would be appreciated. Please see below for details. Thank you, Brian #################################### My Program #################################### void testMessage() { cout << "Creating message..." << endl; FIX::Message message; cout << "Adding field..." << endl; message.setField(35, "A"); // message.setField(FIX::MsgType("A")); // it doesn't matter which way I set the field // message.setField(55, "IBM"); // it doesn't matter which field I set } int main(int argc, const char *argv[]) { testMessage(); return 0; } #################################### GDB Output #################################### (gdb) run Starting program: /home/user/workspace/Client/Debug/Client [Thread debugging using libthread_db enabled] [New Thread -1213826560 (LWP 12088)] Creating message... Adding field... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1213826560 (LWP 12088)] 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 (gdb) backtrace #0 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 #1 0xb7e6083c in __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<int const, FIX::FieldBase> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbfba0dfc, __p=0x8053230, __n=1) at /usr/include/c++/4.1.3/ext/mt_allocator.h:721 #2 0xb7e60938 in std::_Rb_tree<int, std::pair<int const, FIX::FieldBase>, std::_Select1st<std::pair<int const, FIX::FieldBase> >, FIX::message_order, __gnu_cxx::__mt_alloc<std::pair<int const, FIX::FieldBase>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_erase (this=0xbfba0dfc, __x=0x8053230) at /usr/include/c++/4.1.3/bits/stl_tree.h:362 #3 0xb7eb75c9 in FIX::FieldMap::clear (this=0xbfba0df8) at /usr/include/c++/4.1.3/bits/stl_tree.h:692 #4 0xb7eb76a0 in ~FieldMap (this=0xbfba0df8) at FieldMap.cpp:35 #5 0x0804b3a5 in ~Message (this=0xbfba0df8) at /home/user/quickfix/include/quickfix/Message.h:57 #6 0x0804a535 in testMessage () at ../Main.cpp:24 #7 0x0804a5bb in main (argc=8, argv=0xbfba1264) at ../Main.cpp:30 #################################### FieldMap.cpp - WHERE I THINK THE PROBLEM IS #################################### The destructor gets called: --------------------------- FieldMap::~FieldMap() { QF_STACK_IGNORE_BEGIN clear(); QF_STACK_IGNORE_END } The clear method gets called: ----------------------------- void FieldMap::clear() { QF_STACK_PUSH(FieldMap::clear) m_fields.clear(); // ####### The clear method is called on an stl::multimap and this is where the seg fault occurs Groups::iterator i; for ( i = m_groups.begin(); i != m_groups.end(); ++i ) { std::vector < FieldMap* > ::iterator j; for ( j = i->second.begin(); j != i->second.end(); ++j ) delete *j; } m_groups.clear(); QF_STACK_POP } STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. |
From: Mikhail V. <mve...@gm...> - 2009-12-10 16:26:07
|
A stack trace would be helpful here. - Regards, Mikhail Veygman -----Original Message----- From: Brian Hill <bh...@pe...> To: Mikhail Veygman <mve...@gm...> Cc: qui...@li... <qui...@li...> Subject: RE: [Quickfix-developers] problem when message.setField method is called Date: Thu, 10 Dec 2009 09:11:39 -0600 The same problem also occurs when a specific message class is used (i.e. FIX42::NewOrderSingle, etc). I first encountered this problem when I was trying to add a Password field to a Logon message in the toAdmin callback. void TradingApp::toAdmin(FIX::Message& message, const FIX::SessionID& sessionId) { if (message.getHeader().getField(35) == "A") { message.setField(554, "passwordvalue"); //message.setField(FIX::Password("passwordvalue"); // problem occurs either way I try to set the field } } When the destructor on this FIX message was called, the same seg fault occurred. I get this error any time I try to modify or add a field to a FIX message. Thanks in advance Brian -----Original Message----- From: Mikhail Veygman [mailto:mve...@gm...] Sent: Thursday, December 10, 2009 6:56 AM To: Brian Hill Cc: qui...@li... Subject: Re: [Quickfix-developers] problem when message.setField method is called You may want to consider using specific message class defined rather then using the underlying base. - Regards, Mikhail Veygman -----Original Message----- From: Brian Hill <bh...@pe...> To: qui...@li... <qui...@li...> Subject: [Quickfix-developers] problem when message.setField method is called Date: Wed, 9 Dec 2009 11:54:02 -0600 QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Hi, If I modify a FIX message by calling the setField method, I get a segmentation fault when the destructor of the FIX message is called. I am using the latest QuickFIX, Ubuntu 4.1.2-16, and gcc 4.1.3. I have debugged and searched everywhere, but can't find a solution. Any help would be appreciated. Please see below for details. Thank you, Brian #################################### My Program #################################### void testMessage() { cout << "Creating message..." << endl; FIX::Message message; cout << "Adding field..." << endl; message.setField(35, "A"); // message.setField(FIX::MsgType("A")); // it doesn't matter which way I set the field // message.setField(55, "IBM"); // it doesn't matter which field I set } int main(int argc, const char *argv[]) { testMessage(); return 0; } #################################### GDB Output #################################### (gdb) run Starting program: /home/user/workspace/Client/Debug/Client [Thread debugging using libthread_db enabled] [New Thread -1213826560 (LWP 12088)] Creating message... Adding field... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1213826560 (LWP 12088)] 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 (gdb) backtrace #0 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 #1 0xb7e6083c in __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<int const, FIX::FieldBase> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbfba0dfc, __p=0x8053230, __n=1) at /usr/include/c++/4.1.3/ext/mt_allocator.h:721 #2 0xb7e60938 in std::_Rb_tree<int, std::pair<int const, FIX::FieldBase>, std::_Select1st<std::pair<int const, FIX::FieldBase> >, FIX::message_order, __gnu_cxx::__mt_alloc<std::pair<int const, FIX::FieldBase>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_erase (this=0xbfba0dfc, __x=0x8053230) at /usr/include/c++/4.1.3/bits/stl_tree.h:362 #3 0xb7eb75c9 in FIX::FieldMap::clear (this=0xbfba0df8) at /usr/include/c++/4.1.3/bits/stl_tree.h:692 #4 0xb7eb76a0 in ~FieldMap (this=0xbfba0df8) at FieldMap.cpp:35 #5 0x0804b3a5 in ~Message (this=0xbfba0df8) at /home/user/quickfix/include/quickfix/Message.h:57 #6 0x0804a535 in testMessage () at ../Main.cpp:24 #7 0x0804a5bb in main (argc=8, argv=0xbfba1264) at ../Main.cpp:30 #################################### FieldMap.cpp - WHERE I THINK THE PROBLEM IS #################################### The destructor gets called: --------------------------- FieldMap::~FieldMap() { QF_STACK_IGNORE_BEGIN clear(); QF_STACK_IGNORE_END } The clear method gets called: ----------------------------- void FieldMap::clear() { QF_STACK_PUSH(FieldMap::clear) m_fields.clear(); // ####### The clear method is called on an stl::multimap and this is where the seg fault occurs Groups::iterator i; for ( i = m_groups.begin(); i != m_groups.end(); ++i ) { std::vector < FieldMap* > ::iterator j; for ( j = i->second.begin(); j != i->second.end(); ++j ) delete *j; } m_groups.clear(); QF_STACK_POP } STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. |
From: Brian H. <bh...@pe...> - 2009-12-10 18:30:28
|
Here is an example of the stacktrace. There is a problem when the Message's destructor is called. Thank you Brian (gdb) run Starting program: /home/bhill/workspace/Client/Debug/Client [Thread debugging using libthread_db enabled] [New Thread -1213670912 (LWP 13024)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1213670912 (LWP 13024)] 0xb7da2566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 (gdb) bt #0 0xb7da2566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 #1 0xb7e8683c in __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<int const, FIX::FieldBase> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbf90dabc, __p=0x80d8c78, __n=1) at /usr/include/c++/4.1.3/ext/mt_allocator.h:721 #2 0xb7e86938 in std::_Rb_tree<int, std::pair<int const, FIX::FieldBase>, std::_Select1st<std::pair<int const, FIX::FieldBase> >, FIX::message_order, __gnu_cxx::__mt_alloc<std::pair<int const, FIX::FieldBase>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_erase (this=0xbf90dabc, __x=0x80d8c78) at /usr/include/c++/4.1.3/bits/stl_tree.h:362 #3 0xb7edd5c9 in FIX::FieldMap::clear (this=0xbf90dab8) at /usr/include/c++/4.1.3/bits/stl_tree.h:692 #4 0xb7edd850 in ~FieldMap (this=0xbf90dab8) at FieldMap.cpp:35 #5 0xb7e852b6 in ~Message (this=0xbf90da30) at Message.h:57 #6 0xb7e73b76 in FIX::Session::generateLogout (this=0x805b150, text=@0xbf90dc20) at Session.cpp:935 #7 0xb7e74c4b in Session (this=0x805b150, application=@0xbf90e4b8, messageStoreFactory=@0xbf90e440, sessionID=@0x8055350, dataDictionary=@0xbf90dde4, sessionTime=@0xbf90df64, heartBtInt=30, pLogFactory=0x0) at Session.h:67 #8 0xb7e8d055 in FIX::SessionFactory::create (this=0xbf90e2d4, sessionID=@0x8055350, settings=@0x805531c) at SessionFactory.cpp:125 #9 0xb7ea3595 in FIX::Initiator::initialize (this=0xbf90e4f8) at Initiator.cpp:79 #10 0xb7ea4fa0 in Initiator (this=0xbf90e4f8, application=@0xbf90e4b8, messageStoreFactory=@0xbf90e440, settings=@0xbf90e480) at Initiator.cpp:47 #11 0xb7ea9864 in SocketInitiator (this=0xbf90e4f8, application=@0xbf90e4b8, factory=@0xbf90e440, settings=@0xbf90e480) at SocketInitiator.cpp:39 #12 0x0804acb9 in main (argc=8, argv=0xbf90e7c4) at ../Main.cpp:34 -----Original Message----- From: Mikhail Veygman [mailto:mve...@gm...] Sent: Thursday, December 10, 2009 10:26 AM To: Brian Hill Cc: qui...@li... Subject: RE: [Quickfix-developers] problem when message.setField method is called A stack trace would be helpful here. - Regards, Mikhail Veygman -----Original Message----- From: Brian Hill <bh...@pe...> To: Mikhail Veygman <mve...@gm...> Cc: qui...@li... <qui...@li...> Subject: RE: [Quickfix-developers] problem when message.setField method is called Date: Thu, 10 Dec 2009 09:11:39 -0600 The same problem also occurs when a specific message class is used (i.e. FIX42::NewOrderSingle, etc). I first encountered this problem when I was trying to add a Password field to a Logon message in the toAdmin callback. void TradingApp::toAdmin(FIX::Message& message, const FIX::SessionID& sessionId) { if (message.getHeader().getField(35) == "A") { message.setField(554, "passwordvalue"); //message.setField(FIX::Password("passwordvalue"); // problem occurs either way I try to set the field } } When the destructor on this FIX message was called, the same seg fault occurred. I get this error any time I try to modify or add a field to a FIX message. Thanks in advance Brian -----Original Message----- From: Mikhail Veygman [mailto:mve...@gm...] Sent: Thursday, December 10, 2009 6:56 AM To: Brian Hill Cc: qui...@li... Subject: Re: [Quickfix-developers] problem when message.setField method is called You may want to consider using specific message class defined rather then using the underlying base. - Regards, Mikhail Veygman -----Original Message----- From: Brian Hill <bh...@pe...> To: qui...@li... <qui...@li...> Subject: [Quickfix-developers] problem when message.setField method is called Date: Wed, 9 Dec 2009 11:54:02 -0600 QuickFIX Documentation: http://www.quickfixengine.org/quickfix/doc/html/index.html QuickFIX Support: http://www.quickfixengine.org/services.html Hi, If I modify a FIX message by calling the setField method, I get a segmentation fault when the destructor of the FIX message is called. I am using the latest QuickFIX, Ubuntu 4.1.2-16, and gcc 4.1.3. I have debugged and searched everywhere, but can't find a solution. Any help would be appreciated. Please see below for details. Thank you, Brian #################################### My Program #################################### void testMessage() { cout << "Creating message..." << endl; FIX::Message message; cout << "Adding field..." << endl; message.setField(35, "A"); // message.setField(FIX::MsgType("A")); // it doesn't matter which way I set the field // message.setField(55, "IBM"); // it doesn't matter which field I set } int main(int argc, const char *argv[]) { testMessage(); return 0; } #################################### GDB Output #################################### (gdb) run Starting program: /home/user/workspace/Client/Debug/Client [Thread debugging using libthread_db enabled] [New Thread -1213826560 (LWP 12088)] Creating message... Adding field... Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1213826560 (LWP 12088)] 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 (gdb) backtrace #0 0xb7d7c566 in __gnu_cxx::__pool<true>::_M_reclaim_block () from /usr/lib/libstdc++.so.6 #1 0xb7e6083c in __gnu_cxx::__mt_alloc<std::_Rb_tree_node<std::pair<int const, FIX::FieldBase> >, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> >::deallocate (this=0xbfba0dfc, __p=0x8053230, __n=1) at /usr/include/c++/4.1.3/ext/mt_allocator.h:721 #2 0xb7e60938 in std::_Rb_tree<int, std::pair<int const, FIX::FieldBase>, std::_Select1st<std::pair<int const, FIX::FieldBase> >, FIX::message_order, __gnu_cxx::__mt_alloc<std::pair<int const, FIX::FieldBase>, __gnu_cxx::__common_pool_policy<__gnu_cxx::__pool, true> > >::_M_erase (this=0xbfba0dfc, __x=0x8053230) at /usr/include/c++/4.1.3/bits/stl_tree.h:362 #3 0xb7eb75c9 in FIX::FieldMap::clear (this=0xbfba0df8) at /usr/include/c++/4.1.3/bits/stl_tree.h:692 #4 0xb7eb76a0 in ~FieldMap (this=0xbfba0df8) at FieldMap.cpp:35 #5 0x0804b3a5 in ~Message (this=0xbfba0df8) at /home/user/quickfix/include/quickfix/Message.h:57 #6 0x0804a535 in testMessage () at ../Main.cpp:24 #7 0x0804a5bb in main (argc=8, argv=0xbfba1264) at ../Main.cpp:30 #################################### FieldMap.cpp - WHERE I THINK THE PROBLEM IS #################################### The destructor gets called: --------------------------- FieldMap::~FieldMap() { QF_STACK_IGNORE_BEGIN clear(); QF_STACK_IGNORE_END } The clear method gets called: ----------------------------- void FieldMap::clear() { QF_STACK_PUSH(FieldMap::clear) m_fields.clear(); // ####### The clear method is called on an stl::multimap and this is where the seg fault occurs Groups::iterator i; for ( i = m_groups.begin(); i != m_groups.end(); ++i ) { std::vector < FieldMap* > ::iterator j; for ( j = i->second.begin(); j != i->second.end(); ++j ) delete *j; } m_groups.clear(); QF_STACK_POP } STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. ------------------------------------------------------------------------------ Return on Information: Google Enterprise Search pays you back Get the facts. http://p.sf.net/sfu/google-dev2dev _______________________________________________ Quickfix-developers mailing list Qui...@li... https://lists.sourceforge.net/lists/listinfo/quickfix-developers STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. STATEMENT OF CONFIDENTIALITY: This message and any attachments are intended solely for the person or entity to which it is addressed and may contain confidential or privileged information. If the recipient of this message is not the addressee or a person responsible for delivering the message to the addressee, such recipient is prohibited from reading or using this message in any way. If you have received this message in error, please call the sender of this message immediately and delete the message from any computer. |