Home Help Center

Evictor problem

xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
I'm developing a freeze aplication and same times but not allways when I call evicor->createObject(Ice::Identity,ObjectPtr) ocurrs a segmentation fault in the server side.

My application use three evictors nows and three databases one for each evictor
the error only afect when i create objects in one of the evictors no in the othes but the code of this is similar to the others.

the aplication is a virtual shop

I have the following slice definitions
A slice definitio for date time Date.ice this work well
The shop in file TiendaRez.ice this work well
A store for the shop in Almacen.ice this work well
A addressBook in Agenda.ice (the error ocurrs when I create a person object
in the Agenda::_evictor but no always)

the implentation of the Agenda are in the following files AgendaI.cpp AgendaI.h
PersonaI.h PersonaI.cpp EntidadI.h EntidadI.cpp

The freeze map for Agenda are:

FREEZE_AGENDA = --dict PersonaPersistentMap,Ice::Identity,Persona \
--dict EmpresaPersistentMap,Ice::Identity,Empresa \
--dict AddressPersistentMap,Ice::Identity,Address \
--dict MailAddressPersistentMap,Ice::Identity,MailAddress \
--dict PhoneNumberPersistentMap,Ice::Identity,PhoneNumber agendaDb TiendaRez.ice

if you want you can download the source files from SOURCES

My developing system is gentoo linux

db 4.1.25
xerces 2.2.0
gcc version 3.2.3 20030422

Thanks you for all

Comments

  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    degug information of segmentation

    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: Evictor: found "agenda/soundfuktoryAgenda" in the queue ]
    Creating PersonaI from AgendaFactory
    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: DB: writing value in database "agendaDb" ]
    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: DB: creating cursor for "agendaDb" ]
    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: DB: creating cursor for "agendaDb" ]
    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: DB: closing cursor "agendaDb" ]
    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: DB: closing cursor "agendaDb" ]
    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: Evictor: created "agenda/337D0004-BB48-47DB-BABD-E9D5B99329E4" ]
    person creating in evictor ok
    [ /root/programacion/proyectos/ice/srv-1.5/serverTienda: Evictor: found "agenda/soundfuktoryAgenda" in the queue ]
    Creating PersonaI from AgendaFactory

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 49156 (LWP 2524)]
    0x4045eb46 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Hi,

    I looked at your code but didn't see any obvious problems. It would help to have a stack trace of the segmentation fault. I recommend that you rebuild your server without optimization and with debugging (-g). Run the server in the debugger, and when the segfault occurs, use the 'bt' command to generate a stack trace.

    It's unclear to me why you are using slice2freeze to generate several persistent maps. It is not necessary to generate these maps in order to use the evictor with those types. The evictor uses a private map (of Ice::Identity to Ice::Object) that can be used with any object types.

    - Mark
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    I confused with the use of freeze maps if i have only one freeze map. can i create in this map any type of ice objects? in the case that I use only one map can I continuig using the three evictor of only one evictor
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    stack trace compiling with out optimizations

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread 65541 (LWP 1256)]
    0x4045eb46 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5
    (gdb) bt
    #0 0x4045eb46 in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <char, std::char_traits<char>, std::allocator<char> >(std::basic_ostream<char, std::char_traits<char> >&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.2.3/libstdc++.so.5
    #1 0x403349a7 in IceUtil::XMLOutput& IceUtil::operator<< <std::string>(IceUtil::XMLOutput&, std::string const&) (
    out=@0x8207c10, val=@0x81f69d0) at OutputUtil.h:217
    #2 0x4032f192 in IceXML::StreamI::writeEnum(std::string const&, std::vector<std::string, std::allocator<std::string> > const&, int) (this=0x8207c00, name=@0x4297c92c, table=@0x81f1a2c, ordinal=16) at StreamI.cpp:454
    #3 0x08075e63 in ice_marshal(std::string const&, IceInternal::Handle<Ice::Stream> const&, EntidadType) (
    __name=@0x4297c92c, __os=@0x4297cadc, v=16) at Agenda.cpp:3534
    #4 0x0809f6ba in Entidad::__marshal(IceInternal::Handle<Ice::Stream> const&) const (this=0x8206a6c, __os=@0x4297cadc)
    at Agenda.cpp:11794
    #5 0x080a131b in Persona::__marshal(IceInternal::Handle<Ice::Stream> const&) const (this=0x8206abc, __os=@0x4297cadc)
    at Agenda.cpp:12403
    #6 0x080b15ec in virtual thunk to Persona::__marshal(IceInternal::Handle<Ice::Stream> const&) const () at Agenda.h:2547
    #7 0x40333c71 in IceXML::StreamI::writeObjectData(std::string const&, std::string const&, IceInternal::Handle<Ice::Object> const&) (this=0x8207c00, name=@0x4297cb6c, id=@0x820710c, obj=@0x8207108) at StreamI.cpp:1386
    #8 0x40333783 in IceXML::StreamI::dumpUnwrittenObjects() (this=0x8207c00) at StreamI.cpp:1324
    #9 0x403333c8 in IceXML::StreamI::endWrite() (this=0x8207c00) at StreamI.cpp:1265
    #10 0x4032ef63 in IceXML::StreamI::endWriteStruct() (this=0x8207c00) at StreamI.cpp:406
    #11 0x4024e9aa in Freeze::ObjectRecord::ice_marshal(std::string const&, IceInternal::Handle<Ice::Stream> const&) const (
    this=0x4297cfc4, __name=@0x4297cc7c, __os=@0x4297cc8c) at ObjectRecord.cpp:196
    #12 0x4026fa11 in Freeze::IdentityObjectRecordDictValueCodec::write(Freeze::ObjectRecord const&, std::vector<char, std::allocator<char> >&, IceInternal::Handle<Ice::Communicator> const&) (v=@0x4297cfc4, bytes=@0x4297ce1c, communicator=@0x4297ce3c)
    at IdentityObjectRecordDict.cpp:58
    #13 0x40267e71 in Freeze::DBMap<Ice::Identity, Freeze::ObjectRecord, Freeze::IdentityObjectRecordDictKeyCodec, Freeze::IdentityObjectRecordDictValueCodec>::insert(std::pair<Ice::Identity const, Freeze::ObjectRecord const> const&) (this=0x82055dc,
    key=@0x4297cfbc) at Map.h:695
    #14 0x402646b1 in Freeze::EvictorI::createObject(Ice::Identity const&, IceInternal::Handle<Ice::Object> const&) (
    this=0x82055c0, ident=@0x4297d0ec, servant=@0x4297d0dc) at EvictorI.cpp:153
    #15 0x0814626e in AgendaI::createPersona(IceInternal::Handle<Persona> const&, Ice::Current const&) (this=0x8205f80,
    person=@0x4297d15c) at AgendaI.cpp:50
    #16 0x0809a7f7 in AgendaAdmin::___createPersona(IceInternal::Incoming&, Ice::Current const&) (this=0x8205f80,
    __in=@0x4297d3fc, __current=@0x4297d3fc) at Agenda.cpp:10223
    #17 0x0809c6a1 in Agenda::__dispatch(IceInternal::Incoming&, Ice::Current const&) (this=0x820600c, in=@0x4297d3fc,
    current=@0x4297d3fc) at Agenda.cpp:10891
    #18 0x080b0913 in virtual thunk to Agenda::__dispatch(IceInternal::Incoming&, Ice::Current const&) () at Agenda.h:2347
    #19 0x4018107b in IceInternal::Incoming::invoke(IceInternal::Handle<IceInternal::ServantManager> const&) (this=0x4297d3fc,
    servantManager=@0x82066c8) at Incoming.cpp:203
    #20 0x4015be65 in IceInternal::Connection::message(IceInternal::BasicStream&, IceInternal::Handle<IceInternal::ThreadPool> const&) (this=0x8206630, stream=@0x4297d6ac, threadPool=@0x4297d8bc) at Connection.cpp:1246
    #21 0x4018a66c in IceInternal::ThreadPool::run() (this=0x8206180) at ThreadPool.cpp:556
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Originally posted by xdm
    I confused with the use of freeze maps if i have only one freeze map. can i create in this map any type of ice objects? in the case that I use only one map can I continuig using the three evictor of only one evictor
    Sorry, I'm afraid I don't quite understand what you're asking.

    An application does not need to manually generate any Freeze maps in order to use the evictor. Since the value type of the evictor's internal map is Ice::Object, it can store instances of any Ice object type in the same database. So, you could use one evictor for all of your objects, or any number of evictors, as appropriate for your application. Each evictor must still have its own database, of course.
  • mesmes CaliforniaAdministrators, ZeroC Staff Mark SpruiellOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Thanks for the stack trace. Unfortunately, it's not clear why the program would be crashing here.

    Is it possible for you to provide the sources for a client that we could use to reproduce the crash?

    - Mark
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    Client

    Hi
    I have a client developing whith qt you can dowload sources and executable files

    the executable file name is almacen
    the proyect file for qt designer is almacen.pro
    the error ocurs in tab Agenda whe I push butthon Nueva Persona ("New person")
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    qt meta oject + ice object

    I proving the server again whit a simple client that create persons in a bucle and now the server work well

    The problem only hampens whe I use the qt client version
    I think that is derived fron the use of QT meta objects whiht Ice Objest but I`n no sure

    Thank you for all
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    Hi,

    I use Ice & Qt extensively with no issues. What problem do you think you're having precisely?

    Regards, Matthew
  • xdmxdm La Coruña, SpainAdministrators, ZeroC Staff Jose Gutierrez de la ConchaOrganization: ZeroC, Inc.Project: Ice Developer ZeroC Staff
    In the first time I think that the proble was samo of the code generate by the qt meta compiler but Now I detec the real problem. the problem is that i forget the renturn value I same bool methods of the Ice Server and then crass ocur when i invoke same of this methos but not Allways. Now I rewrite this methods whit it's correct return value and all works fine in Ice whith Qt

    I have and other question about Qt and Ice, Have you any example of A Qt object thas is and ice object too

    Thank for all, In especial For Ice a very powerfull tool for good programing
  • matthewmatthew NL, CanadaMember Matthew NewhookOrganization: ZeroC, Inc.Project: Internet Communications Engine ✭✭✭
    In the first time I think that the proble was samo of the code generate by the qt meta compiler but Now I detec the real problem. the problem is that i forget the renturn value I same bool methods of the Ice Server and then crass ocur when i invoke same of this methos but not Allways. Now I rewrite this methods whit it's correct return value and all works fine in Ice whith Qt

    I'm glad you found out your problem :)

    In my use of Qt & Ice I typically make the servant delegate to the Qt widget to avoid the aforementioned problem.

    The typical flow is:
    - The Servant receives a method invocation (note that this will be in a thread other than the main Qt event loop thread).
    - The Servant delegates to the Qt widget. In this call the widget dispatches a Qt custom event (to avoid multi-threading problems) to itself.
    - This event is then received by the widget in the event loop thread and processed.

    Regards, Matthew
Sign In or Register to comment.