Menu

#818 Segfault in polled device at startup

closed-fixed
nobody
None
C++ API
5
2017-01-09
2016-10-06
No

I have run into a segfault that seems to be related to the fix of bug #814. So it might not happen if that patch is not applied, I have not tested that.

The problem can be reproduced by these steps:

  • Add a new server and device to the DB (I have not been able to make it happen unless it's the first time the server is run after being added)
  • Configure polling on e.g. State, by writing the "polled_attr" property. The interval does not seem to matter.
  • Start the server. It will sometimes (maybe 1 time out of 10) immediately segfault.

I'm attaching a short python script that performs this test. It probably needs to be run a few times before it catches the problem. It assumes the TangoTest device to be available in the path.

By some debugging, I've come to the conclusion that the issue comes from line 641 in blackbox.cpp. It assumes that if the call does not come from polling or from an user thread, it's from a client. But the host may also be "init" under some circumstances (I guess right after startup) and in that case a null pointer error happens a bit later. At least, modifying the line to something like:
~~~
if (box[insert_elt].host_ip_str[0] == 'p' || box[insert_elt].host_ip_str[0] == 'u' ||
box[insert_elt].host_ip_str[0] == 'i') // this is the new part
~~~
appears to solve the problem.

1 Attachments

Discussion

  • Johan Forsberg

    Johan Forsberg - 2016-10-06

    It appears that this bug is harder to provoke if the TANGO database is not running on the same host, I suppose because of the extra time it takes to get the information.

    The context is that I'm trying to script some automatic tests where TANGO servers are created and removed all the time, and the database is local. So it may be that this bug almost never appears in "real" cases, but it's very annoying in this particular case.

     
  • Emmanuel Taurel

    Emmanuel Taurel - 2016-10-10

    Hi Johan,

    There is a bug fix commited in the SVN repo. Hoping this help

    Emmanuel

     
  • Bourtembourg Reynald

    • status: open --> closed-fixed
     
  • Bourtembourg Reynald

    Fixed in Tango 9.2.5

     

Log in to post a comment.