Results 1 to 5 of 5

Thread: weird segmentation fault

  1. #1
    buptstehc is offline Registered User
    Name: chuan huang
    Organization: CISDI Information Technology Co., Ltd
    Project: protocol adapter
    Join Date
    Jun 2011
    Posts
    7

    weird segmentation fault

    hi, all! My app crashes receiving sigsegv signal when starts. This is the output from gdb:

    #0 0x009e8649 in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::compare(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const () from /usr/lib/i386-linux-gnu/libstdc++.so.6
    ...
    #6 0x0034b85b in IceInternal::FactoryTable::addObjectFactory (this=0x81252f8, t=..., f=...) at FactoryTable.cpp:96
    #7 0x0090beda in __F__jupiter__JRequest__Init () at ../jbase.cpp:322
    #8 __static_initialization_and_destruction_0 () at ../jbase.cpp:331
    #9 global constructors keyed to jbase.cpp(void) () at ../jbase.cpp:647
    #10 0x00939f6d in __do_global_ctors_aux () from /home/henry/Work/jupiter/comm/dll/.libs/libjuserclass.so.0
    #11 0x00907f40 in _init () from /home/henry/Work/jupiter/comm/dll/.libs/libjuserclass.so.0

    libjuserclass is a dll, and JRequest is a class defined in jbase.ice.
    //jbase.ice
    module jupiter {
    // Protocols supportted for now.
    enum JCommType {
    //...
    };

    // Since hub is stateless, you must tell hub what do you want.
    enum JAction {
    //...
    };

    // All requests sending to hub must subclass from this.
    class JRequest {
    JCommType type; //type of communication
    JAction act; //name of calling method
    };

    // All classes receiving from hub must subclass from this.
    class JResponse {
    bool success = true;
    };
    };
    #endif

    The weird thing is the app crashes before calling the function referenced from the dll. please help!

  2. #2
    xdm's Avatar
    xdm
    xdm is online now ZeroC Staff
    Name: Jose Gutierrez de la Concha
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Sep 2003
    Location
    La Coruņa, Spain
    Posts
    588
    Hi,

    Can you provide an small test case that reproduce the problem? that will be easier way to know what is happening.

    We need to know the OS, Compiler and Ice versions.

    Can you post the complete stack trace?

    The weird thing is the app crashes before calling the function referenced from the dll. please help!
    That is a problem with static initializations, so don't need to call any functions.

    Regards,
    Jose

  3. #3
    buptstehc is offline Registered User
    Name: chuan huang
    Organization: CISDI Information Technology Co., Ltd
    Project: protocol adapter
    Join Date
    Jun 2011
    Posts
    7
    Quote Originally Posted by xdm View Post
    Hi,

    Can you provide an small test case that reproduce the problem? that will be easier way to know what is happening.

    We need to know the OS, Compiler and Ice versions.

    Can you post the complete stack trace?



    That is a problem with static initializations, so don't need to call any functions.

    Regards,
    Jose
    Thanks for the reply. Since my app is a little complex, it is not very convenient to paste my code here. this my env:
    os: ubuntu 11.04
    compiler: g++ 4.5.2
    ice:3.4.1
    this the entire output from gdb:

    ***********************************gdb output**************************************
    Program received signal SIGSEGV, Segmentation fault.
    0x0098a56a in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
    (gdb) bt
    #0 0x0098a56a in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/i386-linux-gnu/libstdc++.so.6
    #1 0x0034ca4b in std:air<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std:air<IceInternal::Handle<Ice::ObjectFactory>, int> >:air (this=0xbfffefb0, __a=..., __b=...) at /usr/include/c++/4.5/bits/stl_pair.h:88
    #2 0x0034c1d2 in std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std:air<IceInternal::Handle<Ice::ObjectFactory>, int>, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std:air<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std:air<IceInternal::Handle<Ice::ObjectFactory>, int> > > >:perator[] (this=0x8125328, __k=...) at /usr/include/c++/4.5/bits/stl_map.h:451
    #3 0x0034b8c1 in IceInternal::FactoryTable::addObjectFactory (this=0x81252f8, t=..., f=...) at FactoryTable.cpp:99
    #4 0x008e638a in __F__jupiter__JRequest__Init () at ../jbase.cpp:322
    #5 __static_initialization_and_destruction_0 () at ../jbase.cpp:331
    #6 global constructors keyed to jbase.cpp(void) () at ../jbase.cpp:647
    #7 0x008f307d in __do_global_ctors_aux () from /home/henry/Work/jupiter/comm/dll/.libs/libjuserclass.so.0
    #8 0x008e2f2c in _init () from /home/henry/Work/jupiter/comm/dll/.libs/libjuserclass.so.0
    #9 0x0011e64c in ?? () from /lib/ld-linux.so.2
    #10 0x0011e769 in ?? () from /lib/ld-linux.so.2
    #11 0x0011088f in ?? () from /lib/ld-linux.so.2
    ***********************************gdb output**************************************
    and this the slice file 'jbase.ice':
    ***********************************jbase.ice****** ********************************
    #ifndef __JBASE_ICE__

    #define __JBASE_ICE__



    module jupiter {

    // Protocols supportted for now.

    enum JCommType {

    kActiveSocket,

    kPassiveSocket,

    kOpc,

    kMq

    };



    // Since hub is stateless, you must tell hub what do you want.

    enum JAction {

    kOpcReadItem,

    kOpcReadItemByGroup,

    kOpcWriteItem,

    kOpcCreateGroup,

    kOpcRemoveGroup,

    kOpcServers,

    kOpcListItems,

    kActiveSocketSend,

    kActiveSocketReceive,

    kPassiveSocketSend,

    kMqSend,

    kMqReceive

    };



    // All requests sending to hub must subclass from this.

    class JRequest {

    JCommType type; //type of communication

    JAction act; //name of calling method

    };



    // All classes receiving from hub must subclass from this.

    class JResponse {

    bool success = true;

    };



    // All classes sending to hub must subclass from this.

    class JUserClassReq {

    };

    };

    #endif
    ***********************************jbase.ice****** ********************************
    It seems that the app crashes when initializing the global object. In addition, my app runs very well in vs studio 2008.

  4. #4
    bernard's Avatar
    bernard is online now ZeroC Staff
    Name: Bernard Normier
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Palm Beach Gardens, FL
    Posts
    1,294
    The global object that is not initialized (but should be) is apparently the IceInternal::factoryTable.

    The registration that fails is triggered by the presence of Slice classes in your Slice; beyond that, I don't expect these definitions matter.

    The best would be to post a small test-case that reproduces this problem, with its build system.

    Best regards,
    Bernard
    Bernard Normier
    ZeroC, Inc.

  5. #5
    buptstehc is offline Registered User
    Name: chuan huang
    Organization: CISDI Information Technology Co., Ltd
    Project: protocol adapter
    Join Date
    Jun 2011
    Posts
    7
    Quote Originally Posted by bernard View Post
    The global object that is not initialized (but should be) is apparently the IceInternal::factoryTable.

    The registration that fails is triggered by the presence of Slice classes in your Slice; beyond that, I don't expect these definitions matter.

    The best would be to post a small test-case that reproduces this problem, with its build system.

    Best regards,
    Bernard
    i have solved this problem. the cause is that the app linked 'jbase.o' which has been linked in the dll. thanks all!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. ICE 3.4.0 / 3.4.1 bug (segmentation fault)
    By PrzemekD in forum Bug Reports
    Replies: 6
    Last Post: 08-05-2010, 12:05 PM
  2. Segmentation fault with Ice for Python
    By bobc in forum Help Center
    Replies: 1
    Last Post: 01-20-2009, 12:38 PM
  3. Segmentation fault with Freeze
    By Yunqiao Yin in forum Help Center
    Replies: 2
    Last Post: 02-12-2007, 08:08 PM
  4. Segmentation fault in Icestorm
    By davidcr1983 in forum Help Center
    Replies: 4
    Last Post: 08-08-2006, 09:37 AM
  5. Replies: 2
    Last Post: 01-08-2006, 08:51 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •