Skip to content

Fix for failing throws_on_invalid_pragma_in_config_file test on Windows#1742

Merged
MichaelOrlov merged 1 commit intorollingfrom
morlov/fix-for-failing-throws_on_invalid_pragma_in_config_file
Jul 13, 2024
Merged

Fix for failing throws_on_invalid_pragma_in_config_file test on Windows#1742
MichaelOrlov merged 1 commit intorollingfrom
morlov/fix-for-failing-throws_on_invalid_pragma_in_config_file

Conversation

@MichaelOrlov
Copy link
Copy Markdown
Contributor

RCA (Root Cause Analysis)

The failure was because the database file was not properly closed after throwing an exception from the SqliteWrapper constructor, and std::filesystem::remove_all(..) failed to delete a temporary folder in the test fixture destructor.

Fixes

  • I added a reset for the prepared SQL statement before throwing the exception.
  • Try to close the database in the constructor if we get an exception after opening the database since the destructor will not be called in this case.

- The failure was because database file was not properly closed after
throwing exception from the SqliteWrapper constructor and
std::filesystem::remove_all(..) failed to delete temporary folder in the
test fixture destructor.
- Added reset for prepared sql statement before throwing exception.
- Try to close database in constructor if we got exception after
opening it since destructor will not be called in this case.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
@MichaelOrlov MichaelOrlov marked this pull request as ready for review July 12, 2024 02:32
@MichaelOrlov MichaelOrlov requested a review from a team as a code owner July 12, 2024 02:32
@MichaelOrlov MichaelOrlov requested review from ahcorde, clalancette, gbiggs and jhdcs and removed request for a team, gbiggs and jhdcs July 12, 2024 02:32
@MichaelOrlov MichaelOrlov self-assigned this Jul 12, 2024
Copy link
Copy Markdown
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks reasonable to me with green CI.

@MichaelOrlov
Copy link
Copy Markdown
Contributor Author

Pulls: #1742
Gist: https://gist.githubusercontent.com/MichaelOrlov/a852da0ff13e6bd37f0b4c505f49810d/raw/b61863a809b7505479cdf52397b76fba0854edeb/ros2.repos
BUILD args: --packages-above-and-dependencies rosbag2_storage_sqlite3 rosbag2_tests
TEST args: --packages-above rosbag2_storage_sqlite3 rosbag2_tests
ROS Distro: rolling
Job: ci_launcher
ci_launcher ran: https://ci.ros2.org/job/ci_launcher/14230

  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@MichaelOrlov MichaelOrlov merged commit 055935d into rolling Jul 13, 2024
@MichaelOrlov
Copy link
Copy Markdown
Contributor Author

https://github.com/Mergifyio backport jazzy iron humble

@mergify
Copy link
Copy Markdown

mergify bot commented Jul 13, 2024

backport jazzy iron humble

✅ Backports have been created

Details

mergify bot pushed a commit that referenced this pull request Jul 13, 2024
…1742)

- The failure was because database file was not properly closed after
throwing exception from the SqliteWrapper constructor and
std::filesystem::remove_all(..) failed to delete temporary folder in the
test fixture destructor.
- Added reset for prepared sql statement before throwing exception.
- Try to close database in constructor if we got exception after
opening it since destructor will not be called in this case.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 055935d)
mergify bot pushed a commit that referenced this pull request Jul 13, 2024
…1742)

- The failure was because database file was not properly closed after
throwing exception from the SqliteWrapper constructor and
std::filesystem::remove_all(..) failed to delete temporary folder in the
test fixture destructor.
- Added reset for prepared sql statement before throwing exception.
- Try to close database in constructor if we got exception after
opening it since destructor will not be called in this case.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 055935d)
mergify bot pushed a commit that referenced this pull request Jul 13, 2024
…1742)

- The failure was because database file was not properly closed after
throwing exception from the SqliteWrapper constructor and
std::filesystem::remove_all(..) failed to delete temporary folder in the
test fixture destructor.
- Added reset for prepared sql statement before throwing exception.
- Try to close database in constructor if we got exception after
opening it since destructor will not be called in this case.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 055935d)

# Conflicts:
#	rosbag2_storage_default_plugins/src/rosbag2_storage_default_plugins/sqlite/sqlite_wrapper.cpp
@MichaelOrlov MichaelOrlov deleted the morlov/fix-for-failing-throws_on_invalid_pragma_in_config_file branch July 13, 2024 00:10
MichaelOrlov pushed a commit that referenced this pull request Jul 13, 2024
…1742) (#1746)

- The failure was because database file was not properly closed after
throwing exception from the SqliteWrapper constructor and
std::filesystem::remove_all(..) failed to delete temporary folder in the
test fixture destructor.
- Added reset for prepared sql statement before throwing exception.
- Try to close database in constructor if we got exception after
opening it since destructor will not be called in this case.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 055935d)

Co-authored-by: Michael Orlov <michael.orlov@apex.ai>
MichaelOrlov pushed a commit that referenced this pull request Jul 13, 2024
…1742) (#1747)

- The failure was because database file was not properly closed after
throwing exception from the SqliteWrapper constructor and
std::filesystem::remove_all(..) failed to delete temporary folder in the
test fixture destructor.
- Added reset for prepared sql statement before throwing exception.
- Try to close database in constructor if we got exception after
opening it since destructor will not be called in this case.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 055935d)

Co-authored-by: Michael Orlov <michael.orlov@apex.ai>
MichaelOrlov pushed a commit that referenced this pull request Jul 16, 2024
… on Windows (backport #1742) (#1748)

* Fix for failing throws_on_invalid_pragma_in_config_file on Windows (#1742)

- The failure was because database file was not properly closed after
throwing exception from the SqliteWrapper constructor and
std::filesystem::remove_all(..) failed to delete temporary folder in the
test fixture destructor.
- Added reset for prepared sql statement before throwing exception.
- Try to close database in constructor if we got exception after
opening it since destructor will not be called in this case.

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
(cherry picked from commit 055935d)

# Conflicts:
#	rosbag2_storage_default_plugins/src/rosbag2_storage_default_plugins/sqlite/sqlite_wrapper.cpp

* Address merge conflicts

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>

---------

Signed-off-by: Michael Orlov <michael.orlov@apex.ai>
Co-authored-by: Michael Orlov <michael.orlov@apex.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants