Results 1 to 2 of 2

Thread: IcePy segfaults on incorrect router configuration

  1. #1
    vsevolod is offline Registered User
    Name: Vsevolod Fedorov
    Organization: "NTC Komset"
    Project: telecom monitoring (ss7,sigtran,etc) software
    Join Date
    Oct 2009
    Posts
    4

    IcePy segfaults on incorrect router configuration

    When calling createObjectAdapterWithRouter method by python program any exception leads to segfault.
    Code:
    import sys, Ice
    
    class Client(Ice.Application):
      def run(self, args):
        ic = self.communicator()
        router = ic.stringToProxy('Glacier2/router:default')
        router = Ice.RouterPrx.uncheckedCast(router)
        adapter = ic.createObjectAdapterWithRouter('TestAdapter', router)
    
    app = Client()
    sys.exit(app.main(sys.argv))
    Code:
    $ ./test.py 
    Segmentation fault
    As I can see from Communicator.cpp source Python global interpreter lock is released when C++ exception is converted to Python. But it is used implicitly by setPythonException function.
    Code:
        AllowThreads allowThreads; // Release Python's global interpreter lock to avoid a potential deadlock.
    
        assert(self->communicator);
        Ice::ObjectAdapterPtr adapter;
        try
        {
            adapter = (*self->communicator)->createObjectAdapterWithRouter(name, router);
        }
        catch(const Ice::Exception& ex)
        {
            setPythonException(ex);
            return 0;
        }
    Code:
    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 0xb7c986c0 (LWP 32635)]
    0xb7eee1cd in PyImport_GetModuleDict () at Python/import.c:363
    363             PyInterpreterState *interp = PyThreadState_GET()->interp;
    (gdb) bt
    #0  0xb7e601cd in PyImport_GetModuleDict () at Python/import.c:363
    #1  0xb7a9ad4d in IcePy::lookupType (typeName=@0xbf93f860) at Util.cpp:511
    #2  0xb7a9c9b2 in IcePy::convertException (ex=@0x8120dc8) at Util.cpp:746
    #3  0xb7a9cfba in IcePy::setPythonException (ex=@0x8120dc8) at Util.cpp:796
    #4  0xb7a3dd16 in communicatorCreateObjectAdapterWithRouter (self=0x8262420, args=0x8093a6c) at Communicator.cpp:1016
    ...
    Tested on Linux, Ice-3.3.1 and Ice-3.2.1

  2. #2
    mes's Avatar
    mes
    mes is offline ZeroC Staff
    Name: Mark Spruiell
    Organization: ZeroC, Inc.
    Project: Ice Developer
    Join Date
    Feb 2003
    Location
    California
    Posts
    1,441
    Welcome to the forum!

    I've confirmed this bug. You can fix it by moving the AllowThreads line inside the try block.

    Thanks for bringing this to our attention.

    Regards,
    Mark

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. FAQ contains incorrect code?
    By oliverk in forum Help Center
    Replies: 1
    Last Post: 04-20-2010, 04:59 PM
  2. Replies: 4
    Last Post: 12-15-2009, 08:36 PM
  3. icegridadmin segfaults with malformed descriptor
    By n2503v in forum Bug Reports
    Replies: 2
    Last Post: 08-29-2009, 09:22 PM
  4. using Monitor segfaults
    By timruijs in forum Help Center
    Replies: 2
    Last Post: 07-19-2004, 10:37 AM
  5. Replies: 1
    Last Post: 11-28-2003, 03:11 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
  •