Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doxygen segfaults on ign-gazebo6 and ign-gazebo7 #1409

Closed
j-rivero opened this issue Mar 24, 2022 · 5 comments · Fixed by #1643
Closed

Doxygen segfaults on ign-gazebo6 and ign-gazebo7 #1409

j-rivero opened this issue Mar 24, 2022 · 5 comments · Fixed by #1643
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation 🏯 fortress Ignition Fortress 🌱 garden Ignition Garden

Comments

@j-rivero
Copy link
Contributor

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.

@j-rivero j-rivero added bug Something isn't working 🏯 fortress Ignition Fortress 🌱 garden Ignition Garden labels Mar 24, 2022
@j-rivero j-rivero self-assigned this Mar 24, 2022
j-rivero added a commit to gazebo-release/gz-sim7-release that referenced this issue Mar 24, 2022
@chapulina
Copy link
Contributor

Our doc upload jobs have been passing for ign-gazebo6 using BIonic:

https://github.com/ignitionrobotics/docs/runs/5671770965?check_suite_focus=true

@chapulina chapulina added the documentation Improvements or additions to documentation label Mar 24, 2022
@j-rivero j-rivero mentioned this issue Apr 5, 2022
8 tasks
@j-rivero
Copy link
Contributor Author

j-rivero commented Apr 5, 2022

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.

@chapulina
Copy link
Contributor

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

chapulina pushed a commit to gazebo-release/gz-sim7-release that referenced this issue Apr 8, 2022
* Support for Jammy

* Can not run doxygen successfully

See gazebosim/gz-sim#1409
@chapulina
Copy link
Contributor

It looks like the problem is with ADDITIONAL_INPUT_DIRS, commenting out this line fixes compilation on Jammy:

ADDITIONAL_INPUT_DIRS "${CMAKE_SOURCE_DIR}/src/systems ${CMAKE_SOURCE_DIR}/src/gui/plugins"

I suspect this happens because Jammy uses a newer version of doxygen. I started updating the doxygen file from Bionic to Focal in

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.

@chapulina chapulina mentioned this issue Aug 11, 2022
8 tasks
@chapulina
Copy link
Contributor

Here's the fix:

Only after opening the PR I noticed that the fix had already been mentioned in

Doxygen's newer versions are really sensitive to those inline namespaces

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation 🏯 fortress Ignition Fortress 🌱 garden Ignition Garden
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants