-
Notifications
You must be signed in to change notification settings - Fork 34
segmentation fault reading attribute (or accessing DevProxy in general) during application shutdown #540
Comments
Hi @delleceste , Indeed, if you access DeviceProxy objects after the ORB has been shut down, you will be in trouble. Tango::ApiUtil::cleanup() will , among other things, shutdown the ORB. |
@delleceste Could you use code blocks for the code? @bourtemb |
Hello Reynald. Thanks.
No, I don't explicitly call ApiUtil::cleanup anywhere from my code.
Giacomo
El vie., 8 mar. 2019 a las 11:36, Thomas Braun (<notifications@github.com>)
escribió:
… @delleceste <https://github.com/delleceste> Could you use code blocks for
the code?
@bourtemb <https://github.com/bourtemb>
But we could just throw in the DeviceProxy members if orb is a nullptr.
It doesn't has to crash.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#540 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABJB7-BlcWPGvvP0-zuli0Ug5eoi8qvBks5vUj1CgaJpZM4blDO1>
.
--
Giacomo S.
http://www.giacomos.it
Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY
-
040 3758073
328 3237959
- - - - - - - - - - - - - - - - - - - - - -
* iqfire-wall, un progetto
open source che implementa un
filtro di pacchetti di rete per Linux,
e` disponibile per il download qui:
http://sourceforge.net/projects/ipfire-wall
* Informazioni e pagina web ufficiale:
http://www.giacomos.it/iqfire/index.html
- - - - - - - - - - - - - - - - - - - - - -
. '' `.
: :' :
`. ` '
`- Debian GNU/Linux -- The power of freedom
http://www.debian.org
|
Giacomo, How is the Qt plugin system managing your classes? I got some questions recently from someone who was doing something similar on Windows and had trouble when unloading the library using Tango. The solution was to call Shutting down the ORB before unloading a dynamic library using CORBA is actually what is recommended in omniORB documentation (section 2.8.6 ORB destruction, page 18), at least when dealing with Windows DLLs. Could you please try that if that fits your use case? |
I made a simple test, trying to use an already created DeviceProxy after the ORB has been shut down. |
Thanks Reynald.
I didn't receive a BAD INV ORDER rather an segmentation fault pointing to a
mutex_unlock.
I can provide full backtrace monday.
I do not want to perform any action during library unload on the
DeviceProxy, but simply deleting it causes the same trouble.
So maybe the library is unloaded after ORB shutdown and DeviceProxy cannot
be deleted there.
So I see no way to work it around right now!
A trick is to get a reference to the plugin a little bit EARLIER In the
code and delete the device there.
But it would be good not to have this nuisance of course!
Thanks again.
Giacomo.
Il giorno ven 8 mar 2019 alle ore 15:07 Reynald Bourtembourg <
notifications@github.com> ha scritto:
… @bourtemb <https://github.com/bourtemb>
But we could just throw in the DeviceProxy members if orb is a nullptr.
It doesn't has to crash.
I made a simple test, trying to use an already created DeviceProxy after
the ORB has been shut down.
We get a BAD_INV_ORDER CORBA system exception:
BAD_INV_ORDER_ORBHasShutdown exception in this case, as in #449
<#449>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#540 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABJB7zB_H4AnmsIZUCN1TXB2qa-CL5X_ks5vUm6QgaJpZM4blDO1>
.
|
Hello Reynald.
This is the backtrace I get from gdb:
Core was generated by `./bin/cumparsita forms/spectrum.ui test/device/1
test/device/2'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x00007fe59127bdf4 in pthread_mutex_lock () from
/usr/lib64/libpthread.so.0
[Current thread is 1 (LWP 19684)]
(gdb) bt
#0 0x00007fe59127bdf4 in pthread_mutex_lock () from
/usr/lib64/libpthread.so.0
#1 0x00007fe592a5192e in omni_mutex::lock (this=<optimized out>) at
../../../../include/omnithread.h:255
#2 omni::duplicateObjRef (objref=0xf5f130) at omniInternal.cc:305
#3 0x00007fe593475519 in Tango::Device_5::_duplicate (obj=0xf5f110) at
/home/giacomo/devel/cppTango/cppapi/server/idl/tangoSK.cpp:6080
#4 0x00007fe59339972a in Tango::DeviceProxy::read_attribute
(this=0xf4f790, attr_string=...)
at /home/giacomo/devel/cppTango/cppapi/client/devapi_base.cpp:5919
#5 0x00007fe59333bd4f in Tango::DeviceProxy::read_attribute
(this=0xf4f790, att_name=<optimized out>)
at /home/giacomo/devel/cppTango/cppapi/client/DeviceProxy.h:666
#6 0x00007fe58d00ea28 in
CuCustomWidgetCollectionInterface::~CuCustomWidgetCollectionInterface
(this=0xf35a70, __in_chrg=<optimized out>)
at cucontrolsplugin.cpp:239
#7 0x00007fe58d00eaa1 in
CuCustomWidgetCollectionInterface::~CuCustomWidgetCollectionInterface
(this=0xf35a70, __in_chrg=<optimized out>)
at cucontrolsplugin.cpp:232
#8 0x00007fe59158cebb in ?? () from /usr/lib64/libQt5Core.so.5
#9 0x00007fe59158e6b5 in ?? () from /usr/lib64/libQt5Core.so.5
#10 0x00007fe590dbc2a7 in __cxa_finalize () from /usr/lib64/libc.so.6
#11 0x00007fe5913b27b3 in ?? () from /usr/lib64/libQt5Core.so.5
#12 0x00007ffd3f418140 in ?? ()
#13 0x00007fe593d3ff76 in _dl_fini () at dl-fini.c:138
Backtrace stopped: frame did not save the PC
(gdb)
Best regards
Giacomo.
El vie., 8 mar. 2019 a las 19:38, Giacomo (<delleceste@gmail.com>) escribió:
… Thanks Reynald.
I didn't receive a BAD INV ORDER rather an segmentation fault pointing to
a mutex_unlock.
I can provide full backtrace monday.
I do not want to perform any action during library unload on the
DeviceProxy, but simply deleting it causes the same trouble.
So maybe the library is unloaded after ORB shutdown and DeviceProxy cannot
be deleted there.
So I see no way to work it around right now!
A trick is to get a reference to the plugin a little bit EARLIER In the
code and delete the device there.
But it would be good not to have this nuisance of course!
Thanks again.
Giacomo.
Il giorno ven 8 mar 2019 alle ore 15:07 Reynald Bourtembourg <
***@***.***> ha scritto:
> @bourtemb <https://github.com/bourtemb>
> But we could just throw in the DeviceProxy members if orb is a nullptr.
> It doesn't has to crash.
>
> I made a simple test, trying to use an already created DeviceProxy after
> the ORB has been shut down.
> We get a BAD_INV_ORDER CORBA system exception:
> BAD_INV_ORDER_ORBHasShutdown exception in this case, as in #449
> <#449>
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <#540 (comment)>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/ABJB7zB_H4AnmsIZUCN1TXB2qa-CL5X_ks5vUm6QgaJpZM4blDO1>
> .
>
--
Giacomo S.
http://www.giacomos.it
Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY
-
040 3758073
328 3237959
- - - - - - - - - - - - - - - - - - - - - -
* iqfire-wall, un progetto
open source che implementa un
filtro di pacchetti di rete per Linux,
e` disponibile per il download qui:
http://sourceforge.net/projects/ipfire-wall
* Informazioni e pagina web ufficiale:
http://www.giacomos.it/iqfire/index.html
- - - - - - - - - - - - - - - - - - - - - -
. '' `.
: :' :
`. ` '
`- Debian GNU/Linux -- The power of freedom
http://www.debian.org
|
@delleceste I tried to delete a DeviceProxy object after the ORB had been shutdown. No crash, no error. Could it be that Qt is unloading the Tango library before your library? |
Hello Reynald
El lun., 11 mar. 2019 a las 18:55, Reynald Bourtembourg (<
notifications@github.com>) escribió:
@delleceste <https://github.com/delleceste>
Thanks for the backtrace.
What version of cppTango are you using
freshly cloned end of last week
I tried to delete a DeviceProxy object after the ORB had been shutdown. No
crash, no error.
Could it be that Qt is unloading the Tango library before your library?
That's quite likely. The workaround I described in one of my first emails
deletes device proxy earlier in order to avoid the crash.
But how would I know exactly when and how Qt unloads Tango library?
Do you load several similar Tango plugins together?
Actually maybe the QTango alongside the cumbia one.
I could try with one only if you think that makes a difference.
Giacomo
… —
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#540 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABJB7zY-gYFBdgw7JAZSXnGnrMInoF8Hks5vVpiagaJpZM4blDO1>
.
--
Giacomo S.
http://www.giacomos.it
Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY
-
040 3758073
328 3237959
- - - - - - - - - - - - - - - - - - - - - -
* iqfire-wall, un progetto
open source che implementa un
filtro di pacchetti di rete per Linux,
e` disponibile per il download qui:
http://sourceforge.net/projects/ipfire-wall
* Informazioni e pagina web ufficiale:
http://www.giacomos.it/iqfire/index.html
- - - - - - - - - - - - - - - - - - - - - -
. '' `.
: :' :
`. ` '
`- Debian GNU/Linux -- The power of freedom
http://www.debian.org
|
That's a very good question... I don't know how Qt deals with the libraries, especially when several plugins depending on a same library are loaded and unloaded.
I think it's worth a try. |
OK I Will. so there will be only one Tango plugin loaded by the application.
El mar., 12 mar. 2019 a las 10:27, Reynald Bourtembourg (<
notifications@github.com>) escribió:
… I tried to delete a DeviceProxy object after the ORB had been shutdown. No
crash, no error. Could it be that Qt is unloading the Tango library before
your library?
That's quite likely. The workaround I described in one of my first emails
deletes device proxy earlier in order to avoid the crash. But how would I
know exactly when and how Qt unloads Tango library?
That's a very good question... I don't know how Qt deals with the
libraries, especially when several plugins depending on a same library are
loaded and unloaded.
Do you load several similar Tango plugins together?
Actually maybe the QTango alongside the cumbia one. I could try with one
only if you think that makes a difference. Giacomo
I think it's worth a try.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#540 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABJB759co0dc8yVe4fPnFYg93yTO3cfOks5vV3MFgaJpZM4blDO1>
.
--
Giacomo S.
http://www.giacomos.it
Sincrotrone Trieste S.C.p.A. di interesse nazionale
Strada Statale 14 - km 163,5 in AREA Science Park
34149 Basovizza, Trieste ITALY
-
040 3758073
328 3237959
- - - - - - - - - - - - - - - - - - - - - -
* iqfire-wall, un progetto
open source che implementa un
filtro di pacchetti di rete per Linux,
e` disponibile per il download qui:
http://sourceforge.net/projects/ipfire-wall
* Informazioni e pagina web ufficiale:
http://www.giacomos.it/iqfire/index.html
- - - - - - - - - - - - - - - - - - - - - -
. '' `.
: :' :
`. ` '
`- Debian GNU/Linux -- The power of freedom
http://www.debian.org
|
Hi @delleceste , |
Hello.
This sample code represents a Qt class which is created at application startup and then destroyed when the application exists.
This class is destroyed by Qt at the very end of the application life cycle. It is managed by Qt plugin system, so it is created and free by Qt.
In practise, I would like to accurately free Tango DeviceProxies when the Qt designer releases its resources at close time.
In normal Qt applications, when it's me who decides the proper point when to destroy Tango DeviceProxy references, I do not face the issue.
I guess there is a moment in an application life after which it becomes unsafe to access a DeviceProxy previously instantiated and used.
Can you confirm this?
What is this moment? (I remind from former releases something called the shutdown of the ORB)
Is it possible to fix it?
Thanks in advance.
Giacomo. ELETTRA
The text was updated successfully, but these errors were encountered: