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

fix: Initialize curl in the correct order #341

Merged
merged 4 commits into from
Jul 21, 2020
Merged

fix: Initialize curl in the correct order #341

merged 4 commits into from
Jul 21, 2020

Conversation

Swatinem
Copy link
Member

@Swatinem Swatinem commented Jul 16, 2020

This also checks more thoroughly for both curl and winhttp state.

Also reworks the transport startup to be fallible, and re-orders the startup path a little bit.

This also checks more thoroughly for both curl and winhttp state.
@Swatinem Swatinem requested a review from a team July 16, 2020 08:57
@codecov-commenter
Copy link

codecov-commenter commented Jul 16, 2020

Codecov Report

Merging #341 into master will decrease coverage by 0.22%.
The diff coverage is 76.34%.

@@            Coverage Diff             @@
##           master     #341      +/-   ##
==========================================
- Coverage   87.59%   87.37%   -0.23%     
==========================================
  Files          49       49              
  Lines        3998     4039      +41     
==========================================
+ Hits         3502     3529      +27     
- Misses        496      510      +14     

flub
flub previously approved these changes Jul 16, 2020
@Swatinem Swatinem requested a review from flub July 16, 2020 12:03
@Swatinem Swatinem dismissed flub’s stale review July 16, 2020 13:54

reworked the startup logic

@Swatinem Swatinem requested review from a team and removed request for flub July 16, 2020 13:55
include/sentry.h Outdated Show resolved Hide resolved
(void)scope;
}
if (backend && backend->user_consent_changed_func) {
backend->user_consent_changed_func(backend);
}

// after initializing the transport, we will submit all the unsent envelopes
// and handle remaining sessions.
sentry__process_old_runs(options);
Copy link
Member

Choose a reason for hiding this comment

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

The old order of execution was: options -> transport -> old runs -> backend.
The new order of execution is: transport -> backend -> options -> old runs.

Are we sure that it is fine to clean up old runs after initializing the backend?

Copy link
Member Author

Choose a reason for hiding this comment

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

The transport previously required the global options but that was fixed already. The problem with the backend is that it currently uses "public" API internally, which requires the global options.
The other option would be to set the options, and afterwards unset them again in case the backends fails to init, which would be observable from the outside, which is also weird.
The cleanest thing to do would be to explicitly pass the options around, but that is hard to do right now.

All-in-all, I think options should only be set once when the SDK was successfully initialized and is ready to be used.

(void)scope;
}
if (backend && backend->user_consent_changed_func) {
backend->user_consent_changed_func(backend);
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we do this in the backend then? It seems like it is the responsibility of the backend to make sure that the initial configuration is applied.

src/sentry_core.c Show resolved Hide resolved
src/sentry_core.c Show resolved Hide resolved
src/sentry_transport.c Outdated Show resolved Hide resolved
src/transports/sentry_transport_winhttp.c Outdated Show resolved Hide resolved
@Swatinem Swatinem merged commit b1debcb into master Jul 21, 2020
@Swatinem Swatinem deleted the fix/curl-init branch July 21, 2020 15:18
* step in the event pipeline.
*
* Envelopes will be submitted to the transport in a _fire and forget_ fashion,
* and the transport must send those envelopes _in order_.
Copy link
Contributor

Choose a reason for hiding this comment

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

Envelopes have to be sent in order now? So the transport can't send envelopes in parallel then.
This should be noted in the CHANGELOG as a breaking change as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

this has been the case ever since release health, since that relies on getting the session updates in order. But sure, I can add it to the changelog as well.

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.

5 participants