Skip to content

fix: catch exception if en_US.utf8-locale missing when parsing datetime headers #251

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

Merged
merged 3 commits into from
Sep 21, 2023

Conversation

cwaldren-ld
Copy link
Contributor

The event delivery subsystem inspects the HTTP headers on the event endpoints whenever it posts a batch of events.

It parses out the date header, storing it for later use. When emitting debug events, it is used to ensure that events stop emitting even if the host's time is off - as a form of time synchronization.

The parsing code is quite ugly, and also wrong - it assumed that en_US.utf-8 would always be available.

This commit hoists the locale loading routine out of the individual flush-workers and into the worker pool. If it can't load the locale, it emits a single warn log at startup explaining the effect.

@shortcut-integration
Copy link

@cwaldren-ld cwaldren-ld force-pushed the cw/sc-217926/date-time-crash branch from e72e001 to 86c92c5 Compare September 20, 2023 23:11
@@ -24,8 +24,6 @@ namespace launchdarkly::events {
*/
class WorkerPool {
public:
using ServerTimeCallback =
std::function<void(std::chrono::system_clock::time_point)>;
/**
Copy link
Contributor Author

Choose a reason for hiding this comment

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

(unused)

@cwaldren-ld cwaldren-ld force-pushed the cw/sc-217926/date-time-crash branch 4 times, most recently from cd9e504 to fdb6a25 Compare September 20, 2023 23:20
@cwaldren-ld cwaldren-ld marked this pull request as ready for review September 21, 2023 01:15
@cwaldren-ld cwaldren-ld requested review from a team and kinyoklion September 21, 2023 01:15
@cwaldren-ld cwaldren-ld changed the title fix: don't crash when parsing datetime headers if en_US.utf8-locale missing fix: catch exception if en_US.utf8-locale missing when parsing datetime headers Sep 21, 2023
@cwaldren-ld
Copy link
Contributor Author

Well this is odd. With no changes to CI, apparently the windows build can't find OpenSSL. Looking into it.

@cwaldren-ld cwaldren-ld force-pushed the cw/sc-217926/date-time-crash branch from 9c49f06 to 3a26c8c Compare September 21, 2023 18:52
@cwaldren-ld cwaldren-ld merged commit eb2a8f0 into main Sep 21, 2023
@cwaldren-ld cwaldren-ld deleted the cw/sc-217926/date-time-crash branch September 21, 2023 19:22
@github-actions github-actions bot mentioned this pull request Sep 21, 2023
cwaldren-ld pushed a commit that referenced this pull request Sep 21, 2023
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-cpp-client: 3.0.9</summary>

### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-internal bumped from 0.1.9 to 0.1.10
</details>

<details><summary>launchdarkly-cpp-internal: 0.1.10</summary>

##
[0.1.10](launchdarkly-cpp-internal-v0.1.9...launchdarkly-cpp-internal-v0.1.10)
(2023-09-21)


### Bug Fixes

* catch exception if en_US.utf8-locale missing when parsing datetime
headers ([#251](#251))
([eb2a8f0](eb2a8f0))
</details>

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants