gz-sim
gz-sim copied to clipboard
Doxygen segfaults on ign-gazebo6 and ign-gazebo7
Environment
- OS Version: Ubuntu Jammy
- Source or binary build? Building packages
https://build.osrfoundation.org/job/ign-gazebo7-debbuilder/271/console
warning: Tag 'TCL_SUBST' at line 237 of file '/home/jenkins/workspace/ign-gazebo7-debbuilder/build/ign-gazebo/obj-x86_64-linux-gnu/api.dox' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
warning: Tag 'COLS_IN_ALPHA_INDEX' at line 1044 of file '/home/jenkins/workspace/ign-gazebo7-debbuilder/build/ign-gazebo/obj-x86_64-linux-gnu/api.dox' has become obsolete.
To avoid this warning please remove this line from your configuration file or upgrade it using "doxygen -u"
make[3]: *** [CMakeFiles/doc.dir/build.make:75: CMakeFiles/doc] Segmentation fault (core dumped)
Description
While building packages, the building job in build.osrfoundation.org was unable to run doxygen properly. It always failed with a segfault. The cause could be a huge consumption of memory or other problem with doxygen internals. There are warnings about deprecated behaviour that probably need to be addressed in ign-cmake.
Our doc upload jobs have been passing for ign-gazebo6
using BIonic:
https://github.com/ignitionrobotics/docs/runs/5671770965?check_suite_focus=true
I've been looking into the problem. Some findings:
gdb run:
0x00005580dc0647ec in toDefinitionMutable (d=0x5580e1e7c410) at ./src/definition.cpp:2209
2209 ./src/definition.cpp: No such file or directory.
(gdb) bt
#0 0x00005580dc0647ec in toDefinitionMutable (d=0x5580e1e7c410) at ./src/definition.cpp:2209
#1 0x00005580dbc0e67f in buildNamespaceList (root=0x5580df972780) at ./src/doxygen.cpp:1644
#2 0x00005580dbc0e0aa in buildNamespaceList (root=<optimized out>) at ./src/doxygen.cpp:1685
#3 0x00005580dbc0e0aa in buildNamespaceList (root=<optimized out>) at ./src/doxygen.cpp:1685
#4 0x00005580dbc0e0aa in buildNamespaceList (root=<optimized out>) at ./src/doxygen.cpp:1685
#5 0x00005580dbc0e0aa in buildNamespaceList (root=<optimized out>) at ./src/doxygen.cpp:1685
#6 0x00005580dbc0e0aa in buildNamespaceList (root=<optimized out>) at ./src/doxygen.cpp:1685
#7 0x00005580dbc3c1bb in parseInput () at /usr/include/c++/11/bits/shared_ptr_base.h:1295
#8 0x00005580dbbdc1fe in main (argc=2, argv=0x7ffec49eb288) at ./src/main.cpp:37
gdb breakpoints and inspections:
Breakpoint 9, toDefinitionMutable (d=0x56336968dbd8) at ./src/definition.cpp:2209
2209 in ./src/definition.cpp
(gdb) print d->getReference()
$33 = {m_rep = ""}
(gdb) print d->displayName(TRUE)
$34 = {m_rep = "ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::systems"}
(gdb) print d->name()
$35 = {m_rep = "ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::systems"}
(gdb) c
Continuing.
Breakpoint 9, toDefinitionMutable (d=0x56336968dbd8) at ./src/definition.cpp:2209
2209 in ./src/definition.cpp
(gdb) print d->name()
$36 = {m_rep = "ignition::gazebo::IGNITION_GAZEBO_VERSION_NAMESPACE::systems"}
(gdb) c
Continuing.
Breakpoint 9, toDefinitionMutable (d=0x56336b7f6410) at ./src/definition.cpp:2209
2209 in ./src/definition.cpp
(gdb) print d->name()
Cannot access memory at address 0x563608b644c6
...
Program received signal SIGSEGV, Segmentation fault.
doxygen -d preprocessor api.dox
... snip
Preprocessor output of /home/jrivero/code/ignition/ign-gazebo/src/gui/plugins/visualize_lidar/VisualizeLidar.hh (size: 4342 bytes):
---------
00001 /*
00002 * Copyright (C) 2020 Open Source Robotics Foundation
00003 *
00004 * Licensed under the Apache License, Version 2.0 (the "License");
00005 * you may not use this file except in compliance with the License.
00006 * You may obtain a copy of the License at
00007 *
00008 * http://www.apache.org/licenses/LICENSE-2.0
00009 *
00010 * Unless required by applicable law or agreed to in writing, software
00011 * distributed under the License is distributed on an "AS IS" BASIS,
00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 * See the License for the specific language governing permissions and
00014 * limitations under the License.
00015 *
00016 */
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 namespace ignition
00028 {
00029 namespace gazebo
00030 {
00031 // Inline bracket to help doxygen filtering.
00032 inline namespace IGNITION_GAZEBO_VERSION_NAMESPACE
00033 {
00034 class VisualizeLidarPrivate;
00035
00036 /// \brief Visualize the LaserScan message returned by the sensors. Use the
00037 /// checkbox to turn visualization of non-hitting rays on or off and
00038 /// the textfield to select the message to be visualised. The combobox is
00039 /// used to select the type of visual for the sensor data.
00040 class VisualizeLidar : public GuiSystem
00041 {
00042 Q_OBJECT
00043
00044 /// \brief Topic list
00045 Q_PROPERTY(
00046 QStringList topicList
00047 READ TopicList
00048 WRITE SetTopicList
00049 NOTIFY TopicListChanged
00050 )
00051
00052 /// \brief Min Range
00053 Q_PROPERTY(
00054 QString minRange
00055 READ MinRange
00056 NOTIFY MinRangeChanged
00057 )
00058
00059 /// \brief Max Range
00060 Q_PROPERTY(
00061 QString maxRange
00062 READ MaxRange
00063 NOTIFY MaxRangeChanged
00064 )
00065
00066 /// \brief Constructor
00067 public: VisualizeLidar();
00068
00069 /// \brief Destructor
00070 public: ~VisualizeLidar() override;
00071
00072 // Documentation inherited
00073 public: void LoadConfig(const tinyxml2::XMLElement *_pluginElem) override;
00074
00075 // Documentation Inherited
00076 public: bool eventFilter(QObject *_obj, QEvent *_event) override;
00077
00078 // Documentation inherited
00079 public: void Update(const UpdateInfo &,
00080 EntityComponentManager &_ecm) override;
00081
00082 /// \brief Callback function to get data from the message
00083 /// \param[in]_msg LidarSensor message
00084 public: void OnScan(const msgs::LaserScan &_msg);
00085
00086 /// \brief Load the scene and attach LidarVisual to the scene
00087 public: void LoadLidar();
00088
00089 /// \brief Set visual type of LidarVisual
00090 /// \param[in] _type Index of selected visual type
00091 public: Q_INVOKABLE void UpdateType(int _type);
00092
00093 /// \brief Set lidar visualization size
00094 /// \param[in] _size Size of lidar visualization
00095 public: Q_INVOKABLE void UpdateSize(int _size);
00096
00097 /// \brief Get the topic list as a string
00098 /// \return Message type
00099 public: Q_INVOKABLE QStringList TopicList() const;
00100
00101 /// \brief Set the topic list from a string, for example
00102 /// 'ignition.msgs.StringMsg'
00103 /// \param[in] _topicList Message type
00104 public: Q_INVOKABLE void SetTopicList(const QStringList &_topicList);
00105
00106 /// \brief Notify that topic list has changed
00107 signals: void TopicListChanged();
00108
00109 /// \brief Set topic to subscribe for LidarSensor data
00110 /// \param[in] _topicName Name of selected topic
00111 public: Q_INVOKABLE void OnTopic(const QString &_topicName);
00112
00113 /// \brief Set whether to display non-hitting rays
00114 /// \param[in] _value Boolean value for displaying non hitting rays
00115 public: Q_INVOKABLE void UpdateNonHitting(bool _value);
00116
00117 /// \brief Set whether to display the lidar visual
00118 /// \param[in] _value Boolean value for displaying the visual
00119 public: Q_INVOKABLE void DisplayVisual(bool _value);
00120
00121 /// \brief Callback when refresh button is pressed.
00122 public: Q_INVOKABLE void OnRefresh();
00123
00124 /// \brief Notify that minimum range has changed
00125 signals: void MinRangeChanged();
00126
00127 /// \brief Notify that maximum range has changed
00128 signals: void MaxRangeChanged();
00129
00130 /// \brief Get the maximum range of the lidar sensor (in metres).
00131 /// \return Range, the maximum distance sensed by the sensor.
00132 public: Q_INVOKABLE QString MaxRange() const;
00133
00134 /// \brief Get the minimum range of the lidar sensor (in metres).
00135 /// \return Range, the minimum distance sensed by the sensor.
00136 public: Q_INVOKABLE QString MinRange() const;
00137
00138 /// \internal
00139 /// \brief Pointer to private data
00140 private: std::unique_ptr<VisualizeLidarPrivate> dataPtr;
00141 };
00142 }
00143 }
00144 }
00145
00146
---------
No macros accessible in this file (/home/jrivero/code/ignition/ign-gazebo/src/gui/plugins/visualize_lidar/VisualizeLidar.hh).
Segmentation fault (core dumped)
Hard for me to know what is exactly going on and where. The good news is that using doxygen 1.9.3 statically linked from the doxygen page does not suffer from the problem and works just fine. Unless someone want to spend a bit more of time looking for a workaround in the comments affecting doxygen, I feel like we should workaround the problem by using a newer version of doxygen or not using it at all.
we should workaround the problem by using a newer version of doxygen or not using it at all.
+1 for forcing a newer version if it solves the issue. We're using doxygen to generate our docs here:
https://github.com/ignitionrobotics/docs/blob/master/tools/build_docs.sh
And to run linters here:
https://github.com/ignition-tooling/action-ignition-ci/blob/ca2cabaf9565ba0e8850a7b6409323441d7e7bd4/entrypoint.sh#L151-L156
It looks like the problem is with ADDITIONAL_INPUT_DIRS
, commenting out this line fixes compilation on Jammy:
https://github.com/gazebosim/gz-sim/blob/f39bc25da4a93a0b2ccf5fca8c3e1b6863185a9d/CMakeLists.txt#L242
I suspect this happens because Jammy uses a newer version of doxygen. I started updating the doxygen file from Bionic to Focal in
- https://github.com/gazebosim/gz-cmake/pull/276
Interestingly, gz-gui
also uses ADDITIONAL_INPUT_DIRS
and it doesn't fail. The issue could be that we're passing more than one directory.
Here's the fix:
- https://github.com/gazebosim/gz-sim/pull/1643
Only after opening the PR I noticed that the fix had already been mentioned in
- https://github.com/gazebosim/gz-sim/issues/520#issuecomment-752407762
Doxygen's newer versions are really sensitive to those inline namespaces