astarte-platform / astarte

Core Astarte Repository
https://docs.astarte-platform.org/
Apache License 2.0
240 stars 46 forks source link

DUP: do not crash when purge properties payload is not zlib deflated #889

Closed Annopaolo closed 9 months ago

Annopaolo commented 10 months ago

Due to a quirk in OTP's zlib library, the safe_inflate/1 function can actually throw an error if the payload is malformed.

In all functions errors, {'EXIT',{Reason,Backtrace}}, can be thrown, where Reason describes the error.

The unhandled error made the DataUpdater process crash, resulting in the malformed purge properties message being requeued and so on and so forth. Fix this behaviour by wrapping relevant :zlib calls in a try-catch block.

codecov[bot] commented 10 months ago

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (d3ea3d6) 68.75% compared to head (57ab797) 68.72%. Report is 3 commits behind head on release-1.0.

Files Patch % Lines
...ib/astarte_data_updater_plant/data_updater/impl.ex 46.15% 7 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## release-1.0 #889 +/- ## =============================================== - Coverage 68.75% 68.72% -0.04% =============================================== Files 247 247 Lines 5547 5550 +3 =============================================== Hits 3814 3814 - Misses 1733 1736 +3 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.